d[k] # access (KeyError if missing)
d.get(k) # safe access → None
d.get(k, default) # safe access with default
k in d # membership check
d[k] = v # assign
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java.security.UnrecoverableKeyException: Failed to obtain information about key | |
| at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreSecretKeyFromKeystore(AndroidKeyStoreProvider.java:282) | |
| at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:98) | |
| at java.security.KeyStore.getKey(KeyStore.java:1062) | |
| at com.wallet.crypto.trustapp.util.KS$override.getData(KS.java:145) | |
| at com.wallet.crypto.trustapp.util.KS$override.access$dispatch(Unknown Source:142) | |
| at com.wallet.crypto.trustapp.util.KS.getData(Unknown Source:24) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void mergeSort(char[] str, int i, int j) { | |
| if (i < j) { | |
| int middle = i + (j - i)/2; | |
| mergeSort(str, i, middle); | |
| mergeSort(str, middle, j); | |
| merge(str, i, middle, j); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void mergeSort(char[] str, int i, int j) { | |
| while (i < j) { | |
| int middle = i + (j - i)/2; | |
| mergeSort(str, i, middle); | |
| mergeSort(str, middle, j); | |
| merge(str, i, middle, j); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BigInteger nTokens = new BigDecimal(tokenAmount).multiply(BigDecimal.valueOf((long)Math.pow(10, decimals))).toBigInteger(); | |
| List<Type> params = Arrays.<Type>asList(new Utf8String(to), new Uint256(nTokens)); | |
| List<TypeReference<?>> returnTypes = Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() { }); | |
| Function function = new Function("transfer", params, returnTypes); | |
| String encodedFunction = FunctionEncoder.encode(function); | |
| String password = PasswordManager.getPassword(from, mAppContext); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Given a binary tree, return the bottom-up level order traversal of the values. | |
| //Additional requirement: return list of lists with respective nodes inside | |
| class Node { | |
| Node left; | |
| Node right; | |
| Object data; | |
| } | |
| List<List<Object>> returnButtomUp(Node tree) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aa3cc54d7f10fa3a1737e4997ba27c34f330ce16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <set> | |
| #include <string> | |
| using namspace std; | |
| void swap(string& input, int i, int j) { | |
| if (i < j && i >= 0 && j < input.size()) { | |
| char c = input[i]; | |
| input[i] = input[j]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fileinput | |
| from trie import Trie | |
| operation_types = ["add", "count", "get"] | |
| def contacts_test(): | |
| line_num = 0 | |
| op_count = 0 | |
| trie = Trie() | |
| for line in fileinput.input(): | |
| if line_num == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A Hashmap implementation with hash collision resolution | |
| class HashMap: | |
| n_buckets = 100 | |
| def __init__(self): | |
| self.buckets = HashMap.n_buckets*[[]] | |
| self.size = 0 | |
| @staticmethod |
NewerOlder