Oracle Interview Question

having a string "aaabbcdddaabbe" count how many times each letter appears.

Interview Answers

Anonymous

Nov 18, 2020

Here's a simple solution using a dictionary in python Let n be the number of letters in string, the time complexity of this algorithm is O(n) because we must iterate through each letter in the given input string. Dictionary insertion and retrieval is O(1). def countLetters(string): count_dictionary = {} # initialize the count dictionary for letter in string: count_dictionary[letter] = 0 # get the count of each letter for letter in string: count_dictionary[letter] += 1 print(count_dictionary)

1

Anonymous

Jan 21, 2021

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Oracle or ex-Oracle Applications Developer experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews