Skip to content

Instantly share code, notes, and snippets.

View yehee's full-sized avatar
🚀
Super

Alice yehee

🚀
Super
View GitHub Profile
@yehee
yehee / .bash_profile
Last active May 26, 2020 22:12
Show git branch and short-hand status on terminal command prompt
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() {
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--;
// 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++) {
@yehee
yehee / candy.java
Last active September 23, 2019 04:48
/**
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;
@yehee
yehee / solution.java
Last active April 23, 2022 23:21
A starter template for Google Code Jam and Kickstart
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);
@yehee
yehee / main.java
Last active May 8, 2019 21:46
Cracking the Coding: Practice Problem
// 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) {