L3 Assessment - Dictionary Data Structure
Problem 1
Use your own words, explain what is a dictionary data structure.
Problem 2
Can a key in a dictionary have duplicates?
Problem 3
What is the time complexity of accessing a key and its paired value in a dictionary?
Problem 4
Write an if else statement that check if the key "cherry" exist in the dictionary.
Problem 5
Write a program that stores all keys in a dictionary into a list.
Example:
Problem 6
Write a program that flips the keys and its associated values. You can assume there will be no duplicate values.
Example:
Problem 7
Given a list of integers
numstargettargetYour solution has to have a linear time complexity
O(n)Problem 8
Given a list of integers
numsYour solution has to have a linear time complexity
O(n)Problem 9
Given two stings
s1s2s2s1Find the letter that was added to
s2