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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Harsh Vakharia
March 28, 2016
Education
0
130
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
42
Google Applied CS - Day 3
harshjv
0
53
Google Applied CS - Introduction
harshjv
0
41
Other Decks in Education
See All in Education
AIは若者の成長機会を奪うのか?
frievea
0
180
Cifrado asimétrico
irocho
0
380
MySmartSTEAM 2526
cbtlibrary
0
190
滑空スポーツ講習会2025(実技講習)EMFT講習 実施要領/JSA EMFT 2025 procedure
jsaseminar
0
110
Node-REDで広がるプログラミング教育の可能性
ueponx
1
260
1021
cbtlibrary
0
400
Adobe Express
matleenalaakso
2
8.1k
外国籍エンジニアの挑戦・新卒半年後、気づきと成長の物語
hypebeans
0
730
1014
cbtlibrary
0
530
Chapitre_2_-_Partie_3.pdf
bernhardsvt
0
150
自己紹介 / who-am-i
yasulab
PRO
6
6.3k
IKIGAI World Fes:program
tsutsumi
1
2.6k
Featured
See All Featured
Between Models and Reality
mayunak
1
190
4 Signs Your Business is Dying
shpigford
187
22k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
50
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
770
Site-Speed That Sticks
csswizardry
13
1.1k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Are puppies a ranking factor?
jonoalderson
1
2.7k
Statistics for Hackers
jakevdp
799
230k
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?