Skip to content

Instantly share code, notes, and snippets.

🚀
Super

Alice alice-0-kim

🚀
Super
View GitHub Profile
@alice-0-kim
alice-0-kim / .bash_profile
Last active May 26, 2020
Show git branch and short-hand status on terminal command prompt
View .bash_profile
alias co="cd ~/code"
B="\e[38;5;35m"
C="\e[38;5;50m"
D="\e[38;5;199m"
E="\[\033[00m\]"
b() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
s() {
View leetcode.java
class Solution {
private boolean isDigit(String s) {
return s.matches("\\d");
}
private String generate(String unit, int times) {
StringBuilder sb = new StringBuilder();
while (times > 0) {
sb.append(unit);
times--;
View Google_Kickstart_2019_Solution.java
// Round F
// Flattening
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
for (int t = 1; t <= T; t++) {
View candy.java
/**
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements:
1. Each child must have at least one candy.
2. Children with a higher rating get more candies than their neighbors.
What is the minimum candies you must give?
*/
import java.util.*;
public int candy(int[] ratings) {
int N = ratings.length;
@alice-0-kim
alice-0-kim / solution.java
Last active Apr 19, 2020
A starter template for Google Code Jam and Kickstart
View solution.java
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
for (int t = 1; t <= T; t++) {
int n = 0;
System.out.printf("Case #%d: %d\n", t, n);
@alice-0-kim
alice-0-kim / main.java
Last active May 8, 2019
Cracking the Coding: Practice Problem
View main.java
// ch 8.7
import java.util.*;
public class Main {
public static void main(String args[]) {
System.out.println(getPerms("ab")); // [ab, ba]
System.out.println(getPerms("abc")); // [abc, acb, bac, bca, cab, cba]
System.out.println(getPerms("love")); // [love, loev, lvoe, lveo, leov, levo, olve, olev, ovle, ovel, oelv, oevl, vloe, vleo, vole, voel, velo, veol, elov, elvo, eolv, eovl, evlo, evol]
}
static ArrayList < String > getPerms(String input) {
You can’t perform that action at this time.