Pergunta de entrevista da empresa Google

Implement strcmp() (string compare)

Respostas da entrevista

Sigiloso

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

Sigiloso

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

Sigiloso

5 de ago. de 2021

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