aviralchhabra
BAN USER
Questions (2)
Reputation 20
- 0of 0 votes
Answers":=" denotes the substitution, and "=" is the equal comparator. ======== Initial state of an array "a": [[4, 2, 4, 2], [4, NULL, 4, 2], [2, NULL, 8, 2], [16, NULL, 4, NULL]] ======== Main function: FUNCTION foo() FOR y := 0 to 3 FOR x := 0 to 3 IF a[x+1][y] != NULL IF a[x+1][y] = a[x][y] a[x][y] := a[x][y]*2 a[x+1][y] := NULL END IF IF a[x][y] = NULL a[x][y] := a[x+1][y] a[x+1][y] := NULL END IF END IF END FOR END FOR END FUNCTION
What is the issue with the above code, and how would you fix it?
- aviralchhabra in Australia| Report Duplicate | Flag | PURGE
Google Technical Support Engineer Pseudocode
Page:
1
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.