Tip 1 : Practise must do or most asked interview questions available on various platforms.
Tip 2 : Apart from coding also focus on cs fundamentals they are asked in many companies these days.
Tip 1 : Highlight you skills very nicely.
Tip 2 : Also put your every single achievement related to coding profile on the resume.
If the string is “aab”, then its unique permutations in lexicographically increasing order are { “aab”, “aba”, “baa” }.
Used Recursion and took every case and printed permutation for the same.
Used DP solution , used every entry as a jump and check about how max can we jump by every entry and found minimum jumps.
int firstMissingPositive(vector& nums) {
map mp;
for(int i=0;i{
mp[nums[i]]=i;
}
int i;
for( i=0;iif(mp.find(i+1)==mp.end()){
return i+1;
}
}
return i+1;
}
As the answer can be very large, return the answer by taking modulo with 1000000007.
If ‘N’=1
So in 1 step we can reach either to ‘X’ , ‘Y’ or ‘Z’ and can not travel back to ‘O’.
Thus there are 0 ways.
If ‘N’ =2
So there are total three ways :
(i) O->X->O
(ii) O->Y->O
(iii) O->Z->O
If ‘N’ = 3
So there are total 6 ways :
(i) O->X->Y->O
(ii) O->X->Z->O
(iii) O->Y->X->O
(iv) O->Y->Z->O
(v) O->Z->X->O
(vi) O->Z->Y->O
A table T[][] is created where the row represents the number of ways and the column represents the position.
In order to fill the table, one observation needs to be made. That is, we can go back to the position O if we are not at O in the previous step.
Therefore, the number of ways to reach the origin O in the current step is equal to the sum of the number of ways the person is not at the origin O in the previous steps.
If N = 3 and tar = 5 and array elements are [1,2,5] then the number of possible ways of making sum = 5 are:
(1,1,1,1,1)
(1,1,1,2)
(1,2,1,1)
(2,1,1,1)
(1,1,2,1)
(2,2,1)
(1,2,2)
(2,1,2)
(5)
Hence the output will be 9.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL keyword removes duplicate records from a result set?