๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.55K photos
3 videos
95 files
9.64K 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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            int n = scanner.nextInt();
            int[][] matrix = new int[n][n];
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < n; k++) {
                    matrix[j][k] = scanner.nextInt();
                }
            }
            System.out.println(maxTrace(matrix));
        }
    }

    public static int maxTrace(int[][] matrix) {
        int n = matrix.length;
        int maxTrace = Integer.MIN_VALUE;
        for (int l = 1; l <= n; l++) {
            for (int r = 0; r <= n - l; r++) {
                for (int c = 0; c <= n - l; c++) {
                    int trace = 0;
                    for (int i = 0; i < l; i++) {
                        trace += matrix[r + i][c + i];
                    }
                    maxTrace = Math.max(maxTrace, trace);
                }
            }
        }
        return maxTrace;
    }
}

Matrix Trace Challenge โœ…
Hiring for Management Trainees - MBA Passouts (2023-2024 batch)
Location  -Central Park Gurgaon Sector 48
Share your CV with me - talent@centralpark.in
Gurgaon candidates will be preferred.
Sound technical knowledge, sincere, hardworking and analytical.
Should be proficient in use of Microsoft Office - Word, Excel and PowerPoint.
Must be good in written and spoken English.
Cisco Ideathon All Answersโœ…

1. #
2. def
3. [1], [2], [1,3]
4. [4,3,2,1]
5. [1,3,5]

6. List comprehension is a concise way to create a new list based on an existing iterable, while a for loop can be used for various operations
7. Both b and c
8. True, False
9. VLAN - All of the above
10. IP - Address

11. Internet Backbone
12. Aggregation, Access
13. To put the interface into forwarding state immediately, bypassing the listening and learning states.
14. Partial mesh topology
15. The next hop self command allows an IBGP ...


16. IP Phone and Access Points
17. Events
18. It allows the attacker to intercept and manipulate network traffic.
19. The DHCP server that responds first
20. It indicates the best part to reach the destination network.


21. Supported Versions
22. LOCAL_PREF
23. SSID
24. BPDU Filter
25. Switch


26. NA
27. Use NAT Protocol Translation
28. Non broadcast multi access
29. discarding
30. NAT64 is used to translate IPv6 addresses to IPv4 addresses for communication between IPv6-only and IPv4-only hosts.



31. Encryption and MIC with AES and GCMP
32. Packet 5 arrived ...
33. All of them
34. High amount of output
35. IGP



36. 255
37. Activity Tracking and Access Approval
38. Area id
39. Command
40. Ssl and Http



41. Network tap
42. Design to filter
43. Interceptinf and decrypt
44. Engery
45. 12



46. 4.54
47. 3
48. C
49. QOS
50. 37

51. It enables router to forward to IPv6 packets.
52. BGP sync ensured that a router ... its IGP
53. Inverse Query
54. Server virtualisation
55. Administrative distance is a measure ... route.
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;

int solve(int i, vector<int>& lst, int ad, const vector<int>& machineCount, const vector<int>& finalMachineCount, int shiftingCost) {
    int n = machineCount.size();
    if (i == n) {
        int res = ad;
        for (int k = 0; k < 3; ++k) {
            res += abs(lst[k] - finalMachineCount[k]);
        }
        return res;
    }
   
    int res = INT_MAX;
    res = min(res, solve(i + 1, lst, ad, machineCount, finalMachineCount, shiftingCost));
   
    for (int j = 0; j < 3; ++j) {
        lst[j] += machineCount[i];
        if (lst[j] - machineCount[i] != 0) {
            res = min(res, solve(i + 1, lst, ad + shiftingCost, machineCount, finalMachineCount, shiftingCost));
        } else {
            res = min(res, solve(i + 1, lst, ad, machineCount, finalMachineCount, shiftingCost));
        }
        lst[j] -= machineCount[i];
    }
   
    return res;
}

int getMinimumCost(const vector<int>& machineCount, const vector<int>& finalMachineCount, int shiftingCost) {
    vector<int> lst(3, 0);
    return solve(0, lst, 0, machineCount, finalMachineCount, shiftingCost);
}

int main() {
    vector<int> machineCount = { /* your values here */ };
    vector<int> finalMachineCount = { /* your values here */ };
    int shiftingCost = /* your value here */;
   
    cout << getMinimumCost(machineCount, finalMachineCount, shiftingCost) << endl;
    return 0;
}

GetminimumCost โœ…
int par[100005];
int find_par(int u) {
if(par[u] < 0) return u;
par[u] = find_par(par[u]);
return par[u];
}
bool merge(int u, int v) {
u = find_par(u), v = find_par(v);
if(u == v) return false;
if(par[u] > par[v]) swap(u, v);
par[u] += par[v];
par[v] = u;
return true;
}
set<int> g[100005];
vector<int> recoverDeadPods(int n, vector<vector<int>> connections, vector<vector<int>> queries) {
int p = 0;
for(auto x : connections) {
  p = max(p, x[0]);
  p = max(p, x[1]);
}
for(auto x : queries) {
  p = max(p, x[0]);
  p = max(p, x[1]);
}

for(int i = 1; i <= p; i++) par[i] = -1;
for(auto x : connections) {
  merge(x[0], x[1]);
}

for(int i = 1; i <= p; i++) {
  int u = find_par(i);
  g[u].insert(i);
}

vector<int> ans;
for(auto x : queries) {
  if(x[0] == 1) {
   int u = find_par(x[1]);

   if(g[u].empty()) ans.push_back(-1);
   else {
    auto iter = g[u].find(x[1]);
    if(iter != g[u].end()) ans.push_back(x[1]);
    else ans.push_back(*g[u].begin());
   }
  } else {
   int u = find_par(x[1]);
   auto iter = g[u].find(x[1]);
   if(iter != g[u].end()) g[u].erase(iter);
  }
}
return ans;
}

Pods Cisco โœ…
def getMinTime(n, cache):
    # Write your code here
    def solve(mid):
        h = {}
        for i in cache:
            h[i] = 1+h.get(i,0)
        extrawork = 0
        cnt = 0
        for i in range(1,n+1):
            if h.get(i,0) > mid:
                extrawork += h[i]-mid
            else:
                cnt += (mid-h.get(i,0))//2
        return cnt>=extrawork
    l,r = 1, 2*len(cache)
    while l<=r:
        mid = (l+r)//2
        if solve(mid):
            ans = mid
            r = mid-1
        else:
            l = mid+1
    return ans

           
    l,r = 1, len(cache)
    while l<=r:
        mid = (l+r)//2
        if solve(mid):
            ans = mid
            r = mid-1
        else:
            l = mid+1
    return ans

Min time
Cisco โœ