calculator.fcis
BAN USER
Comments (4)
Reputation 20
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote
the code works fine. notice when variable index updated.
second iteration push 6*3 and 6 and in this case index is 1. thrid iteration push 2*6*3, 2*6 and 2.
Comment hidden because of low score. Click to expand.
0
of 0 vote
bool isPermutation(string s1, string s2)
{
if(s1.length != s2.length)
return false;
int []arr = new int[26];
for(int i=0;i<s1.length;i++)
{
int index = s1[i] - 'a';
arr[index]++;
index = s2[i] - 'a';
arr[index]++;
}
for(int i=0;i<arr.length;i++)
if(arr[i] != 0)
return false;
returnt true;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
I think the answer is correct, it does nto matter if both are the same length because you'll need to move p1,p2 zero times and p1 will move in parallel to q1 the same case for p2 and q2
- calculator.fcis December 16, 2011Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
First you need to get maximum value of the array and after that allocate array of this size and loop over it to find maximum difference
//code in C#
- calculator.fcis September 30, 2012