- Add the API key to your
local.properties
file:
apiKey=<value>
- Add to the root level of your app-level
build.gradle
file:
package com.nytimes.android.buggyapp; | |
public class WordAnalyzer { | |
public WordAnalyzer() { | |
} | |
public char firstRepeatedCharacter(String word) { | |
for (int i = 0; i < word.length(); i++) { |
{ | |
"id": 1011, | |
"type": "loadScene", | |
"options": { | |
"sceneUrl": "https://www.example.com/amazing-ar-scene" | |
} | |
} |
{ | |
"id": 1011, | |
"success": "true", | |
"values": {} | |
} |
{ | |
"id": 1, | |
"data": { | |
"type": "downloadProgress", | |
"url": "https://www.example.com/amazing-ar-scene", | |
"totalWritten": 324071, | |
"totalExpected": 578000 | |
} | |
} |
1) Given an string, write a method called HashMap<String, Integer> countTheLetters(String input)
that returns a map containing a count for each of each of the letters in the string. For full credit, your solution should be O(n).
countTheLetters("dog"); // returns a map containing the pairs {d: 1, o: 1, g: 1}
countTheLetters("elephant"); // returns a map containing the pairs {e: 2, l: 1, p: 1, h: 1, a: 1, n: 1, t: 1}
countTheLetters("llama"); // returns a map containing the pairs {l: 2, a: 2, m: 1}