๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.6K subscribers
5.6K photos
3 videos
95 files
10.5K 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>

using namespace std;

int solution(vector<int> &numbers) {
    for (size_t i = 1; i < numbers.size(); ++i) {
        if ((numbers[i] % 2) == (numbers[i - 1] % 2)) {
            return i;
        }
    }
    return -1;
}

Autodesk โœ…
๐Ÿ‘1
public boolean robotRectangle(String moves){
        if(moves.length()<1) return false;
        int upDown=0, rightLeft=0;
        char[] movesArr= moves.toCharArray();
        for(int i= 0; i< movesArr.length; i++){
            if(movesArr[i] == '^')  upDown++;
            else if(movesArr[i] == 'v')  upDown--;
            else if(movesArr[i] == '>')  rightLeft++;
            else if(movesArr[i] == '<')  rightLeft--;
        }
        return upDown== 0 && rightLeft== 0?true:false;   
    }
๐Ÿ‘2
#include <iostream>
#include <unordered_map>
#include <string>

using namespace std;

int solution(vector<int> &A) {
    int max_sum = -1; 

    unordered_map<int, int> same_digits; 

    for (int num : A) {
        int first_last = stoi(to_string(num).substr(0, 1) + to_string(num).substr(to_string(num).length() - 1)); 
        if (same_digits.find(first_last) != same_digits.end()) {
            max_sum = max(max_sum, same_digits[first_last] + num);
        } else {
            same_digits[first_last] = num;
        }
    }

    return max_sum;
}
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
using namespace std;
class SegmentTree {
private:
    vector<int> tree;
    int size;
public:
    SegmentTree(int n) {
        size = 1;
        while (size < n) {
            size *= 2;
        }
        tree.assign(2 * size, 0);
    }
    void update(int idx, int value) {
        idx += size;
        tree[idx] += value;
        while (idx > 1) {
            idx /= 2;
            tree[idx] = tree[2 * idx] + tree[2 * idx + 1];
        }
    }
    int query(int left, int right) {
        left += size;
        right += size + 1;
        int sum = 0;
        while (left < right) {
            if (left % 2 == 1) {
                sum += tree[left];
                left++;
            }
            if (right % 2 == 1) {
                right--;
                sum += tree[right];
            }
            left /= 2;
            right /= 2;
        }
        return sum;
    }
};
vector<int> solution(int numOfEmployees, int numOfQueries, vector<vector<int>>& queries) {
    SegmentTree seg_tree(numOfEmployees);
    vector<int> results;
    for (const auto& query : queries) {
        int q_type = query[0];
        if (q_type == 1) {
            int emp_id = query[1];
            int amount = query[2];
            seg_tree.update(emp_id, amount);
        } else if (q_type == 2) {
            int left = query[1];
            int right = query[2];
            results.push_back(seg_tree.query(left, right));
        }
    }
    return results;
}

Netapp โœ…
Hiring Quality Trainee with 0 to 2 years of experience in Quality from Automotive background.

BE EEE / Mechanical / ECE freshers or 1 to 2 yrs experienced can apply

Interested candidates can share profile to recruitment@besmakindia.com with the subject line " Trainee - Quality"

Job Location- Oragadam
Stack<Integer> st = new Stack<>();
        StringBuilder sb = new StringBuilder();

        for (char ch : s.toCharArray()) {
            int digit = ch - '0';
            while (!st.isEmpty() && digit + st.peek() <= 9) {
                int pop = st.pop();
                digit = pop + digit;
            }
            st.add(digit);
        }

        while (!st.isEmpty()) {
            sb.append(st.pop());

Hashedin โœ…
public static int solution(String S, String T) {
        int n = S.length();
        int[] sArray = new int[n];
        int[] tArray = new int[n];
        for (int i = 0; i < n; i++) {
            sArray[i] = S.charAt(i) - '0';
            tArray[i] = T.charAt(i) - '0';
        }
        int totalMoves = 0;
        for (int i = 0; i < n - 1; i++) {
            int currentDigitS = sArray[i];
            int targetDigitT = tArray[i];

            if (currentDigitS != targetDigitT) {
                int diff = (targetDigitT - currentDigitS + 10) % 10; 
                sArray[i] = (sArray[i] + diff) % 10;
                sArray[i + 1] = (sArray[i + 1] + diff) % 10;
                totalMoves += diff; 
            }
        }
        if (sArray[n - 1] != tArray[n - 1]) {
            return -1;
        }

        return totalMoves;
    }

Hashedin โœ