๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K 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
As placement for 2023 batch is coming, so what u guys want from me....

Like resume review, mock interview, interview experience or any other thing which you guys want, feel free to tell in comment, I will try to help till what I can ๐Ÿ˜Šโœ…
https://practice.geeksforgeeks.org/problems/rat-in-a-maze-problem/1

โœ…โœ…โœ…โœ…โœ…โœ…โœ…โœ…โœ…โœ…โœ…
javascript sol using recursion

Code
_------------------------------------
let solve =(m,n,c,res,i,j)=>{
//base case

if (i==n-1 && j==n-1){
res.push(c);
return ;
}
let val = m[i][j]
m[i][j]=-1

// right
if (j+1<n && m[i][j+1]==1){
solve(m,n,c+"R",res,i,j+1);
}

// down
if (i+1<n && m[i+1][j]==1){
solve(m,n,c+"D",res,i+1,j);
}

// up
if (i-1>=0 && m[i-1][j]==1){
solve(m,n,c+"U",res,i-1,j);
}

//left

if (j-1>=0 && m[i][j-1]==1){
solve(m,n,c+"L",res,i,j-1);
}
m[i][j]=val;
}

class Solution {
findPath(m,n){
//code here
let c="";
let res=[];
let i=0,j=0;
if (m[0][0]==0){
return res;
}
solve(m,n,c,res,i,j);
res.sort();
return res;
}
}
๐Ÿ‘3
long long solve(int N, vector<int> A)
{
vector<long long> vec1, vec2(N);
int max_so_far = 0, max_ending_here = 0;
vec1.push_back(0);
vec2.push_back(0);
for (int i = 0; i < A.size(); i++)
{
max_so_far += A[i];
if (max_so_far > max_ending_here)
max_ending_here = max_so_far;
if (max_so_far < 0)
max_so_far = 0;
vec1.push_back(max_ending_here);
}
max_so_far = 0;
max_ending_here = 0;
for (int i = A.size() - 1; i >= 0; i--)
{
max_so_far += A[i];
if (max_so_far > max_ending_here)
{
max_ending_here = max_so_far;
}
if (max_so_far < 0)
max_so_far = 0;
vec2[i] = max_ending_here;
}
long long ans = 0;
for (int i = 0; i <= N; i++)
{
ans = max(ans, vec1[i] + vec2[i]);
}
return ans;
}
Source - unknown


Phonepe: Two Subarray (C++)โœ…
๐Ÿ‘2
//Given Array A having N integers and divisor K
int morethanNbyK(vector<int> arr, int n, int k)
{
int x = n / k;
int ans = 0;
unordered_map<int, int> freq;
for (auto i : arr)
freq[i]++;
for (auto i : freq)
{
if (i.second > x)
{
ans += i.first;
}
}
return ans;
}

Infosys โœ…
๐Ÿ‘3