allcoding1
27.7K subscribers
2.2K photos
2 videos
74 files
849 links
Download Telegram
Adobe is hiring for SDE l role |
0 - 2 years experience | Noida location | CTC : 12 - 20 LPA ( expected )

https://careers.adobe.com/us/en/job/ADOBUSR146901EXTERNALENUS/Software-Development-Engineer?utm_medium=phenom-feeds&source=LinkedIn&utm_source=linkedin
👍1
miniOrange is hiring for Software Engineer Java

2024/2023/2022 batches eligible

Location : Pune

Last date to apply : 6 PM, 10 July 2024

CTC : 6 - 8 LPA ( expected )

Apply Now :-
https://www.miniorange.com/career/hiring-drive
👍2
Interview Kickstart is hiring for Frontend Engineer I and II | 1 - 4 years experience | Remote |

Apply Now:-
https://interviewkickstart.keka.com/careers/jobdetails/45540
👍1
public static int findEarliestMeetingTime(List<List<int[]>> schedules, int length) {
int DAY_END = 24 * 60;

List<int[]> allMeetings = new ArrayList<>();
for (List<int[]> employeeMeetings : schedules) {
allMeetings.addAll(employeeMeetings);
}

Collections.sort(allMeetings, (a, b) -> Integer.compare(a[0], b[0]));

int earliestAvailable = 0;
for (int[] meeting : allMeetings) {
if (earliestAvailable + length <= meeting[0]) {
return earliestAvailable;
}
earliestAvailable = Math.max(earliestAvailable, meeting[1]);
}

if (earliestAvailable + length <= DAY_END) {
return earliestAvailable;
}

return -1;
}
👍3
public static int findMaximumGreatness(int[] arr) {
int n = arr.length;
Arrays.sort(arr);

int greatness = 0;
int j = 0;

boolean[] used = new boolean[n];

for (int i = 0; i < n; i++) {
while (j < n && (used[j] || arr[j] <= arr[i])) {
j++;
}
if (j < n && arr[j] > arr[i]) {
used[j] = true;
greatness++;
j++;
}
}

return greatness;
}
1👍1
class Result {

    public static void goodSequence(BufferedReader bufferedReader) throws IOException {
        StringTokenizer st = new StringTokenizer(bufferedReader.readLine());
        int T = Integer.parseInt(st.nextToken());

        for (int t = 0; t < T; t++) {
            st = new StringTokenizer(bufferedReader.readLine(), ",");
            int N = Integer.parseInt(st.nextToken());
            int M = Integer.parseInt(st.nextToken());

            st = new StringTokenizer(bufferedReader.readLine(), ",");
            int[] sequence = new int[N];
            for (int i = 0; i < N; i++) {
                sequence[i] = Integer.parseInt(st.nextToken());
            }

            String result = solveTestCase(N, M, sequence);
            System.out.println(result);
        }
    }

    private static String solveTestCase(int N, int M, int[] sequence) {
       
        int countDivisible = 0;
        for (int x : sequence) {
            if (x % M == 0) {
                countDivisible++;
            }
        }

        if (countDivisible == 0) {
            return "0/1";
        }

        long totalSubsequences = (1L << N) - 1;
        long goodSubsequences = (1L << countDivisible) - 1;


        long P = goodSubsequences;
        long Q = totalSubsequences;

        long commonDivisor = gcd(P, Q);

        P /= commonDivisor;
        Q /= commonDivisor;

        return P + "/" + Q;
    }

    private static long gcd(long a, long b) {
        while (b != 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
}
👍3
allcoding1
Photo
import java.util.*;

public class Maib {

    private static int reverseNumber(int num) {
        int reversed = 0;
        while (num != 0) {
            reversed = reversed * 10 + num % 10;
            num /= 10;
        }
        return reversed;
    }

    private static int largestPossibleNumber(int num) {
        char[] digits = String.valueOf(num).toCharArray();
        Arrays.sort(digits);
        StringBuilder largestNumStr = new StringBuilder(new String(digits)).reverse();
        return Integer.parseInt(largestNumStr.toString());
    }

    private static List<Integer> splitIntoDigits(int num) {
        List<Integer> digits = new ArrayList<>();
        while (num != 0) {
            digits.add(num % 10);
            num /= 10;
        }
        Collections.reverse(digits);
        return digits;
    }

    public static String processAndEncodeArray(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = reverseNumber(arr[i]);
        }
       
        for (int i = 0; i < arr.length; i++) {
            arr[i] = largestPossibleNumber(arr[i]);
        }
       
        List<Integer> allDigits = new ArrayList<>();
        for (int num : arr) {
            allDigits.addAll(splitIntoDigits(num));
        }
       
        Set<Integer> uniqueDigits = new LinkedHashSet<>(allDigits);
        List<Integer> uniqueDigitList = new ArrayList<>(uniqueDigits);
       
        // Step 5: Generate the encoded string
        StringBuilder encodedString = new StringBuilder();
        for (int digit : uniqueDigitList) {
            if (digit == 0) {
                encodedString.append('$');
            } else if (digit % 2 == 0) {
                encodedString.append('*');
            } else {
                encodedString.append('#');
            }
        }
       
        return encodedString.toString();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

       String result = processAndEncodeArray(arr);

        System.out.println(result);
    }
}
👍3
Good sequence python
👍1
Palindrome
👍1
allcoding1
Photo
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    vector<string> k = {"1234567890", "qwertyuiop", "asdfghjkl", "zxcvbnm"};
    string w;
    getline(cin, w);
    transform(w.begin(), w.end(), w.begin(), ::tolower);
    vector<string> words;
    string temp;
    for (char c : w)
    {
        if (c == ' ')
        {
            if (!temp.empty())
            {
                words.push_back(temp);
                temp.clear();
            }
        }
        else
        {
            temp += c;
        }
    }
    if (!temp.empty())
    {
        words.push_back(temp);
    }
    int t = 0;

    for (string v : words)
    {
        int l = v.length();
        vector<int> r(l, -1);
        vector<int> p(l, -1);

        for (int i = 0; i < l; ++i)
        {
            bool f = false;
            for (int j = 0; j < k.size(); ++j)
            {
                int c = k[j].find(v[i]);
                if (c != string::npos)
                {
                    r[i] = j;
                    p[i] = c;
                    f = true;
                    break;
                }
            }
            if (!f)
            {
                break;
            }
        }

        int c = 0;
        for (int i = 1; i < l; ++i)
        {
            if (r[i] == r[i - 1] && abs(p[i] - p[i - 1]) <= 1)
            {
                c += 1;
            }
            else
            {
                if (c > 0)
                {
                    if (r[i - 1] == -1)
                    {
                        t += 2;
                    }
                    else
                    {
                        t += 1;
                    }
                    c = 0;
                }
            }
        }

        if (c > 0)
        {
            if (r[l - 1] == -1)
            {
                t += 2;
            }
            else
            {
                t += 1;
            }
        }
    }

    cout << t << endl;

    return 0;
}
👍1
allcoding1
Photo
#include <bits/stdc++.h>
int getMinimumStress(int graph_nodes, int graph_edges, vector<pair<int, int>>& edges, vector<int>& weights, int source, int destination) {
Graph graph(graph_nodes + 1);


for (int i = 0; i < graph_edges; ++i) {
int u = edges[i].first;
int v = edges[i].second;
int w = weights[i];
graph[u].push_back({v, w});
graph[v].push_back({u, w});
}


priority_queue<pii, vector<pii>, greater<pii>> pq;
vector<int> min_stress(graph_nodes + 1, INT_MAX );
pq.push({0, source});
min_stress[source] = 0;

while (!pq.empty()) {
int curr_stress = pq.top().first;
int u = pq.top().second;
pq.pop();

if (u == destination) {
return curr_stress;
}

if (curr_stress > min_stress[u]) {
continue;
}

for (const auto& neighbor : graph[u]) {
int v = neighbor.first;
int weight = neighbor.second;
int next_stress = max(curr_stress, weight);

if (next_stress < min_stress[v]) {
min_stress[v] = next_stress;
pq.push({next_stress, v});
}
}
}

return -1;
}
👍2
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

double solve(const vector<int>& cnts) {
vector<double> den = {0.20, 0.40, 1, 2, 5, 10};
double tot = 0.0;
for (size_t i = 0; i < cnts.size(); ++i) {
tot += cnts[i] * den[i];
}
return tot;
}

int main() {
vector<int> cnts;
int input;
while (cin >> input) {
cnts.push_back(input);
}
cout << solve(cnts) << endl;
return 0;
}
👍1
Ciena is hiring for Software Engineering DevOps New Grad

Expected Salary : 10-20 LPA

Batch : 2024/2023 passouts eligible

Apply here :
https://careers.ciena.com/us/en/job/CIENUSR025123ENUS/Software-Engineering-DevOps-New-Grad

Telegram:- @allcoding1