๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
#include <bits/stdc++.h>
using namespace std;

int solve(string &str)
{
    int ans = 0;
    int j = str.size() - 1;
    while (j >= 0)
    {
        if (str[j] == '1')
        {
            ans += 2;
        }
        else
        {
            ans += 1;
        }
        j--;
    }
    return ans;
}
int main()
{
    string str;
    cin >> str;
    string str2;
    bool flag = false;
    for (int i = 0; i < str.size(); i++)
    {
        if (flag == false and str[i] == '1')
        {
            flag = true;
        }
        if (flag)
        {
            str2 += str[i];
        }
    }
    int ans = solve(str2);
    cout << ans - 1 << endl;
    return 0;
}

Bentley โœ…
List<Integer> redIndex = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'R') redIndex.add(i);
        }
        long res = 0;
        int mid = redIndex.size() / 2; 
        for (int i = 0; i < redIndex.size(); i++) {
            res += Math.abs(redIndex.get(mid) - redIndex.get(i)) - Math.abs(mid - i);
            if (res > 1e9) {
                return -1;
            }
        }
       
        return (res > 1e9) ? -1 : (int) res;
    }

Bentley โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
#include <bits/stdc++.h> using namespace std; int solve(string &str) {     int ans = 0;     int j = str.size() - 1;     while (j >= 0)     {         if (str[j] == '1')         {             ans += 2;         }         else         {             ans += 1;โ€ฆ
def remove_leading_zero(xx: str) -> str:
    letter = list(xx)
    for i in range(len(letter)):
        if letter[i] == '1':
            break
        letter[i] = ' '
    ans = ''.join(letter)
    return ans.strip()

def solution(S: str) -> int:
    xy = remove_leading_zero(S)
    zero_count = 0
    one_count = 0
    f = len(xy)
    for i in range(f):
        if xy[i] == '0':
            zero_count += 1
        else:
            one_count += 1
    return zero_count + (one_count - 1) * 2 + 1

Bentley โœ…
Free Certification Courses

1) JavaScript Fundamentals
2) SQL
3) Git and GitHub
4) HTML and CSS
5) Basic projects

This are the 5 courses which are available for free, and when you will join corporate this are the basic requirements.

Link: https://bit.ly/4avpEUz

Limited time ke liye hai, enroll as soon as possible (Isse pehle paid krde) ๐Ÿคž๐Ÿคž