๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.59K photos
3 videos
95 files
10.2K 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 <string>
using namespace std;
int ss(char c, char f) {
    if (f >= c) {
        return f - c;
    } else {
        return (f - c + 26) % 26;
    }
}
int main() {
    string C, F;
    int N;
    cin >> C >> F >> N;
    int len = C.length();
    int t = 0;
    int s = 0;
    for (int i = 0; i < len; i++) {
        t += ss(C[i], F[i]);
        s += (i + 1);
    }
    if (t <= s) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


MAQ โœ…
๐Ÿ‘1
def getMergedIntervals(intervals):
    intervals.sort(key=lambda x: x[0])
    huihui = []

    for interval in intervals:
        if not huihui or huihui[-1][1] < interval[0]:
            huihui.append(interval)
        else:
            huihui[-1][1] = max(huihui[-1][1], interval[1])
           
    return huihui


Merge intervals โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input_ = "";

process.stdin.on('data', function (data) {
    input_ += data.toString(); 
});

function count_like_dislike(A, P) {
    // Write your code here
    let count = 0;

    if (A.length > 0 && P.length > 0) {
        let a = A.split('');
        let p = P.split('');

        if (a.length >= p.length) {
            for (let i = 0; i < a.length; i++) {
                if (i < p.length && a[i] === p[i]) {
                    count++;
                }
            }
        } else {
            for (let i = 0; i < p.length; i++) {
                if (i < a.length && a[i] === p[i]) {
                    count++;
                }
            }
        }
    }

    return count.toString(); 
}

process.stdin.on('end', function () {
    input_ = input_.split("\n");
    var A = input_.shift();
    var P = input_.shift();

    var out_ = count_like_dislike(A, P);
    process.stdout.write(out_ + '\n');
   
    process.exit();
});

Number of likes and dislikes โœ…
import java.util.List;
public class Main {
    public static long getMaximumSumOfStrengths(List<Integer> arr) {
        int n = arr.size();
        if (n == 0) {
            return 0;
        }

       long[] a = arr.stream().mapToLong(Integer::longValue).toArray();
        long[][] dp = new long[n][2];
        dp[0][0] = a[0];
        dp[0][1] = a[0];
        for (int i = 1; i < n; i++) {
            dp[i][0] = Math.max(dp[i - 1][0], dp[i - 1][1]) + a[i] * (i + 1);
            dp[i][1] = a[i] * i + a[i - 1] * (i + 1) + (i - 2 >= 0 ? Math.max(dp[i - 2][0], dp[i - 2][1]) : 0);
        }
        return Math.max(dp[n - 1][0], dp[n - 1][1]);
    }
}



Element Swapping โœ…
Oracle
โค1๐Ÿ‘1
#include <string>
#include <unordered_map>
int ss(const std::string& S) {
unordered_map<char, int> freq;
        for (char c : S) {
        freq[c]++;
    }
    int a = 0;
    for (const auto& entry : freq) {
        if (entry.second % 2 != 0) {
            a++;
        }
    }
    if (a <= 1) {
        return 0;
    }

    return a - 1;
}

`
String Substring โœ…
DB
*Infosys Recruitment - 2024 Batch*

*Infosys is hiring Specialist Programmers through their off-campus recruitment program!*

Compensation:

โ‚น13 LPA (based on performance)
โ‚น9.5 LPA (based on selection process)

Eligibility:

Courses: BE, BTech, ME, MTech, MCA, MSc (Integrated 5 years), MSc (Mathematics)
Branches: All branches
Academic Criteria:
10th & 12th: 60%
Graduation & Post-graduation: 6 CGPA

Deadline to Apply: Wednesday, 11th September 2024

Apply Here: https://surveys.infosysapps.com/r/a/Infosys_SPhiring_24BATCH_NATCOLLEGES
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

int solve(int K) {
    queue<string> q;
    for (char evenDigit : {'2', '4', '6', '8'}) {
        q.push(string(1, evenDigit));
    }
    int count = 0;
    while (!q.empty()) {
        string currentNum = q.front();
        q.pop();
        count++;
        if (count == K) {
            return stoi(currentNum);
        }
        int length = currentNum.length();
        if (length % 2 == 1) {
            for (char oddDigit : {'1', '3', '5', '7', '9'}) {
                q.push(currentNum + oddDigit);
            }
        } else {
            for (char evenDigit : {'2', '4', '6', '8'}) {
                q.push(currentNum + evenDigit);
            }
        }
    }
    return -1;
}

INTERESTING  NUMBERSโœ