๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K 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 <iostream>
#include <vector>
#include <string>
using namespace std;
int solve(string s) {
    if (s.empty() || s[0] == '0') {
        return 0; 
    }
   
    int n = s.size();
    vector<int> dp(n + 1, 0);
    dp[0] = 1; 
    dp[1] = 1;
   
    for (int i = 2; i <= n; ++i) {
        if (s[i - 1] >= '1' && s[i - 1] <= '9') {
            dp[i] += dp[i - 1];
        }
        int t = stoi(s.substr(i - 2, 2));
        if (t >= 10 && t <= 26) {
            dp[i] += dp[i - 2];
        }
    }
   
    return dp[n];
}

int main() {
    string s;
    cin >> s;
    int result = solve(s);
    cout << result << endl;

    return 0;
}


Decipher the numbersโœ…
Dream11
import re
a = ["Inc.", "Corp.", "LLC", "L.L.C.", "LLC."]
b = ["the", "an", "a", "and"]
def normalize_name(c):
    c = c.lower()
    for d in a:
        if c.endswith(d.lower()):
            c = c[:-len(d)].strip()
    c = re.sub(r'[&,]', ' ', c)
    c = re.sub(r'\s+', ' ', c) 
    d = c.split()
    if d[0] in b:
        d = d[1:]
    c = ' '.join(d)
    return c.strip()
def check_availability(d):
    e = set() 
    for f in d:
        g, c = f.split('|')
        h = normalize_name(c)
        if not h:
            print(f"{g}|Name Not Available")
        elif h in e:
            print(f"{g}|Name Not Available")
        else:
            e.add(h)
            print(f"{g}|Name Available")


Stripe โœ…
๐Ÿ‘1๐Ÿคฎ1
int solution(int[] visits, int target) {
    int runningSum = 0;
    for (int i = 0; i < visits.length; i++) {
        runningSum += visits[i];
        if (runningSum >= target) {
            return i;
        }
    }
    return -1;
}

Visa โœ…
def process_string(number):
    while True:
        found_consecutive = False
        new_string = []
        i = 0
        while i < len(number):
            j = i
            while j < len(number) and number[j] == number[i]:
                j += 1
            if j - i > 1:
                found_consecutive = True
                sum_of_digits = sum(int(number[k]) for k in range(i, j))
                new_string.append(str(sum_of_digits))
            else:
                new_string.append(number[i])
            i = j
        number = ''.join(new_string)
        if not found_consecutive:
            break
    return number


Visa โœ…
def letterCaseDifference(typedText: str) -> int:
    upper_count = 0
    lower_count = 0
    for char in typedText:
        if char.isupper():
            upper_count += 1
        elif char.islower():
            lower_count += 1
    return upper_count - lower_count

Visa โœ…
from collections import Counter
def countValidWords(s):
    def is_valid(word):
        if len(word) < 3:
            return False
        if not all(char.isalnum() for char in word):
            return False
        has_vowel = any(char.lower() in 'aeiou' for char in word)
        has_consonant = any(char.isalpha() and char.lower() not in 'aeiou' for char in word)
        return has_vowel and has_consonant
    words = s.split()
    count = sum(1 for word in words if is_valid(word))
    return count


Word Count Tool โœ…
def roman_to_decimal(a):
    b = {'I': 1, 'V': 5, 'X': 10, 'L': 50} 
    c = 0 

    for i in range(len(a)):
        if i > 0 and b[a[i]] > b[a[i - 1]]:
            c += b[a[i]] - 2 * b[a[i - 1]]
        else:
            c += b[a[i]]

    return c

def sortRoman(names):
    def custom_sort(e):
        d = e.split() 
        return (d[0], roman_to_decimal(d[1]))

    sorted_names = sorted(names, key=custom_sort)
    return sorted_names
Romanizer โœ…
๐Ÿ‘1