Pergunta de entrevista da empresa Sedco

Given an array of characters and a function that accepts an array of char, start index, and end index, use the function to print words in the array, where characters that represent words are separated by spaces.

Resposta da entrevista

Sigiloso

24 de jul. de 2024

def print_words_from_array(char_array): start_index = None array_length = len(char_array) for i in range(array_length): if char_array[i] != ' ': if start_index is None: start_index = i else: if start_index is not None: print(''.join(char_array[start_index:i])) start_index = None if start_index is not None: print(''.join(char_array[start_index:array_length]))