Kr.satish123
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
import sys
def move(arr, index, ans, n):
if(index>n or index<0):
return sys.maxsize
if(index == n-1):
return ans
return min(move(arr, index+arr[index], ans+1, n),
move(arr, index-arr[index], ans+1, n))
if __name__ == "__main__":
arr = [4,3,2,6,1,2,3,4,2,1]
ans = 0
startIndex = 0
destIndex = len(arr)
print(move(arr,startIndex,ans,destIndex))
Comment hidden because of low score. Click to expand.
0
of 0 vote
// true == 1
// false ==0
#include <bits/stdc++.h>
using namespace std;
bool foo(int a , int b)
{
return a^b;
}
int main()
{
int a=0,b=10;
cout<<foo(a,b);
return 0;
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
We can relate this problem to a strongly connected component in the graph.
- Kr.satish123 January 01, 2021Count maximum of all the strongly connected component nodes which are connected to each other.