Skip to content

Instantly share code, notes, and snippets.

View pungrue26's full-sized avatar

Joonho Kim pungrue26

  • Recobell
  • Seoul, South Korea
View GitHub Profile
@pungrue26
pungrue26 / game_agent.py
Last active February 8, 2017 13:46
minimax implementation
def custom_score(game, player):
"""Calculate the heuristic value of a game state from the point of view
of the given player.
Parameters
----------
game : `isolation.Board`
An instance of `isolation.Board` encoding the current state of the
game (e.g., player locations and blocked cells).
@pungrue26
pungrue26 / LargestNumberformedfromanArray.java
Created December 12, 2016 06:27
GeeksforGeeks, Largest Number formed from an Array
import java.util.*;
import java.lang.*;
import java.io.*;
class GFG {
public static void main (String[] args) {
Scanner in = new Scanner (System.in);
int t = in.nextInt();
for (int i = 0; i < t; i++) {
int n = in.nextInt();
@pungrue26
pungrue26 / KthSmallestInLexicographicalOrder.java
Created November 22, 2016 02:45
K-th Smallest in Lexicographical Order
public class Solution {
public int findKthNumber(int n, int k) {
int len = String.valueOf(n).length();
int [] array = new int [len];
array[0] = 1;
for (int i = 1; i < len; i++) {
array[i] = array[i - 1] * 10 + 1;
}
Stack<Integer> s = new Stack<>();
@pungrue26
pungrue26 / LongestValidParentheses.java
Created November 13, 2016 07:20
LeetCode, Longest Valid Parentheses
public class Solution {
public int longestValidParentheses(String s) {
if (s == null || s.isEmpty()) {
return 0;
}
Stack<Pair> stack = new Stack<>();
final int n = s.length();
boolean [] b = new boolean [n];
for (int i = 0; i < n; i++) {
@pungrue26
pungrue26 / MandragoraForest.java
Created October 31, 2016 05:04
Mandragora Forest in HackerRank
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 i = 0; i < t; i++) {
int n = in.nextInt();
@pungrue26
pungrue26 / Breadth_First_Search_Shortest_Reach.java
Created October 24, 2016 02:46
Breadth First Search: Shortest Reach
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws FileNotFoundException {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int i = 0; i < t; i++) {
int n = in.nextInt();
int m = in.nextInt();
@pungrue26
pungrue26 / custom_rules.xml
Created September 1, 2014 09:20
custom_rules.xml example
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<xmlproperty file="AndroidManifest.xml" prefix="mymanifest" collapseAttributes="true"/>
<target name="-pre-compile">
<copy toDir="./gen/com/com2us/golfstarworldtour/normal/freefull/google/global/android/common/" overwrite="true">
<fileset file="./unity_gen_r/golfstar/R.java" />
</copy>
<copy toDir="./gen/com/com2us/peppermint/" overwrite="true">
<fileset file="./unity_gen_r/peppermint/R.java" />
</copy>