Frage im Vorstellungsgespräch bei Google

Implement strcmp() (string compare)

Antworten zu Vorstellungsgespräch

Anonym

17. Aug. 2019

/* Time - O(n) where n is the time length of either a or b Space - O(1) Compare whether the two input strings are equivalent */ private static boolean strCmp(String a, String b) { if(a.length() != b.length()) { return false; } for(int i=0; i

Anonym

17. Aug. 2019

/* Time - O(n) where n is the time length of either a or b Space - O(1) Compare whether the two input strings are equivalent */ private static boolean strCmp(String a, String b) { if(a.length() != b.length()) { return false; } for(int i=0; i

Anonym

5. Aug. 2021

def strcmp(str1, str2): if str1 == str2: return True return False