Pular para o conteúdo principal

3 documentos selecionados com "counting"

Ver todas os Marcadores

Balanced Meals

This question is asked by Apple. You are serving people in a lunch line and need to ensure each person gets a "balanced" meal. A balanced meal is a meal where there exists the same number of food items as drink items. Someone is helping you prepare the meals and hands you food items (i.e. F) or a drink items (D) in the order specified by the items string. Return the maximum number of balanced meals you are able to create without being able to modify items.

Can Construct Passage

This question is asked by Amazon. Given two strings, passage and text, return whether or not the characters in text can be used to form the given passage.

Majority Element

High school students are voting for their class president and you're tasked with counting the votes. Each presidential candidate is represented by a unique integer and the candidate that should win the election is the candidate that has received more than half the votes. Given a list of integers, return the candidate that should become the class president.