Google Interview Question for Software Engineers
- -1of 1 vote
Given two string check if they can be made equivalent by performing some operations on one or both string.- alex August 09, 2018 in United States
swapEven:swap a character at an even-numbered index with a character at another even-numbered index
swapOdd:swap a character at an odd-numbered index with a character at another odd-numbered index
Given : s="cdab" , x="abcd"
s -> cdab ->swap a and c ->adcb (swapEven)-> swap b and d (swapOdd) -> s="abcd" = x="abcd"
Given: s="dcba" , x="abcd"
no amount of operation will move character from an odd index to even index, so the two string will never be equals
Given: s="abcd" ,x="abcdcd"
x length to big so will never be equals
| Report Duplicate | Flag | PURGE
Google Software Engineer
Open Chat in New Window