Pregunta de entrevista de Google

Implement strcmp() (string compare)

Respuestas de entrevistas

Anónimo

17 de ago de 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

Anónimo

17 de ago de 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

Anónimo

5 de ago de 2021

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