Instantly share code, notes, and snippets.

At school

# Alicealice-0-kim

At school
• Sort options
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) {
Created May 19, 2019
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);
Last active Sep 23, 2019
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;
Last active Oct 1, 2019