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
/** | |
* Runtime: 1 ms, faster than 99.96% of Java online submissions for Guess the Word. | |
* Memory Usage: 27.2 MB, less than 7.41% of Java online submissions for Guess the Word. | |
* Solution for: https://leetcode.com/problems/guess-the-word/ | |
*/ | |
class Solution { | |
public void findSecretWord(String[] wordlist, Master master) { | |
int secretLength = wordlist[0].length(); | |
int length = wordlist.length; | |
Random rand = ThreadLocalRandom.current(); |
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
/** | |
* Runtime: 68 ms, faster than 99.94% of Java online submissions for Snapshot Array. | |
* Memory Usage: 72.5 MB, less than 100.00% of Java online submissions for Snapshot Array. | |
* Solution for: https://leetcode.com/problems/snapshot-array/ | |
*/ | |
class SnapshotArray { | |
private int snaps; | |
private Map<Integer, Integer> map; | |
public SnapshotArray(int length) { |
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 class AESCipher { | |
private static final Logger log = LoggerFactory.getLogger(AESCipher.class); | |
private final SecretKey key; | |
private final MoeIV iv; | |
private final SecureRandom random; | |
private final Cipher cipher; | |
private final byte[] pool; |
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 interface Crypto { | |
/** | |
* The decryption cipher. | |
*/ | |
AESCipher decryption(); | |
/** | |
* The encryption cipher. | |
*/ |
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 /simple/ wrapper class for going from Retrofit2 <-> Spark. | |
* All of my Retrofit/Rest interfaces have methods that have the | |
* same name as their default implementations. | |
* See {@link moe.maple.services.base.rest.AccountRest} and {@link AccountService} | |
*/ | |
public class SparkFromRetro { | |
private static final Logger log = LoggerFactory.getLogger( SparkFromRetro.class ); |