Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google Applied CS - Day 1
Search
Harsh Vakharia
March 28, 2016
Education
0
110
Google Applied CS - Day 1
Day 1:
Anagram (HashSet, HashMap and ArrayList) and Scarne's dice
Harsh Vakharia
March 28, 2016
Tweet
Share
More Decks by Harsh Vakharia
See All by Harsh Vakharia
Google Applied CS - Day 4
harshjv
0
32
Google Applied CS - Day 3
harshjv
0
44
Google Applied CS - Introduction
harshjv
0
32
Other Decks in Education
See All in Education
子どもたち創造的活動機会の必要性に関する提言/creativehub
codeforeveryone
0
240
Pre-enrollment Information for UTokyo International Students
utokyoissr2360
0
4.8k
全員参加型で会社を強くしていく活動を考えてみる
ikefukurou777
0
210
Earthquake and Disaster Prevention Information for UTokyo International Students
utokyoissr2360
0
630
2023年度桜井政成ゼミ資料_論文の探し方・読み方
masanari
6
2.2k
Introduction - Lecture 1 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
3k
Copilotとして理解する生成AI利用の基本
gmoriki
0
140
保育とふりかえりをコネクト! / connect childcare and retrospectives!
psj59129
1
160
H5P-työkalut
matleenalaakso
3
32k
Padlet opetuksessa
matleenalaakso
3
11k
アプリ開発を目指した授業づくりについて
asial_corp
0
420
わたしのメタ学習 / My Own Meta Learning #shinjukurb
expajp
0
120
Featured
See All Featured
KATA
mclloyd
15
12k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
How GitHub (no longer) Works
holman
304
140k
Happy Clients
brianwarren
92
6.4k
Designing for Performance
lara
601
67k
It's Worth the Effort
3n
180
27k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
[RailsConf 2023] Rails as a piece of cake
palkan
23
4k
Clear Off the Table
cherdarchuk
84
310k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
How STYLIGHT went responsive
nonsquared
92
4.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
121
39k
Transcript
GOOGLE'S APPLIED CS WITH ANDROID DAY 1
ANAGRAMS
WHAT IS AN ANAGRAM? An anagram is a word formed
by rearranging the letters of another word. — Wikipedia
EXAMPLE Cinema is an anagram of iceman.
MECHANICS 1. Provide user a word from the dictionary. 2.
The user tries to create as many words as possible that contain all the letters of the given word plus one additional letter. 3. The user can give up and see the words that they did not guess.
CATCH The addition of extra letter at the beginning or
the end without reordering the other letters is not valid.
MEANING If the game picks the word 'ore' as a
starter, the user might guess 'rose' or 'zero' but not 'sore'. i.e. 1. rose ✅ 2. s(ore) ❌
STARTER CODE
ANAGRAMDICTIONARY'S CONSTRUCTOR WHAT IS NEEDED? 1. Word validation 2. Random
word selection 3. Get word's anagrams 4. Get words by length (ext)
WORD VALIDATION Set<String> wordSet = new HashSet<>(); ACCESS TIME: O(1)
RANDOM WORD SELECTION ArrayList<String> wordList = new ArrayList<>(); RANDOM ACCESS
TIME: O(1)
GET WORD'S ANAGRAMS Map<String, ArrayList<String>> lettersToWord = new HashMap<>(); ACCESS
TIME: O(1)
GET WORDS BY LENGTH Map<Integer, ArrayList<String>> sizeToWords = new HashMap<>();
SCARNE'S DICE
RULES 1. if they roll a 1, score no points
and lose their turn 2. if they roll a 2 to 6: ▸ add the rolled value to their points ▸ choose to either reroll or keep their score and end their turn
STARTER CODE
THIS IS IT FOR TODAY
ANY DOUBTS?