Skip to content

Instantly share code, notes, and snippets.

View doyonghoon's full-sized avatar

Yong Hoon Do doyonghoon

View GitHub Profile
@doyonghoon
doyonghoon / hashcode.cpp
Created December 3, 2016 03:53
Hashcode Generator
int hashCode(string text) {
int hash = 0;
size_t strlen = text.length(), i;
char character;
if (strlen == 0) {
return hash;
}
for (i = 0; i < strlen; i++) {
character = text.at(i);
hash = (31 * hash) + (character);
@doyonghoon
doyonghoon / TwoSum.java
Last active February 20, 2016 01:17
Find two sum
package problem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TwoSum {
public static void main(String[] args) {
@doyonghoon
doyonghoon / Connection.java
Created February 20, 2016 01:08
Find a relation between nodes
package graph;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@doyonghoon
doyonghoon / main.cpp
Last active November 12, 2015 21:06
Uguly Carpet
/*
Write a C++ program that creates a customer bill for a carpet company. The following information is input:
The length of width of the carpet in feet.
The carpet price per square foot
The percent of discount for the customer
@doyonghoon
doyonghoon / MrJohnSmith.java
Created November 8, 2015 01:33
interview problem 1
package com.spencerdo.brain;
/**
* Created by doyonghoon on 2015. 11. 7..
*/
public class MrJohnSmith {
private static final String NAME = "Mr John Smith";
private static final char[] whitespace = new char[]{'0', '2', '%'};
@doyonghoon
doyonghoon / Parser.java
Created October 5, 2015 07:07
sample parser
package dyh.parser;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@doyonghoon
doyonghoon / LambdaQueryType.java
Created June 23, 2015 03:54
enum type that holds an interface could be expressed elegantly using lambda expression.
package com.frograms.watcha.retrofit;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.frograms.watcha.listeners.WatchaQuery;
import com.frograms.watcha.model.response.BaseResponse;
import com.frograms.watcha.model.response.data.list.ListData;
import java.util.Map;
/**
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@doyonghoon
doyonghoon / checkGooglePlayServiceVersion.java
Last active August 29, 2015 14:05
show an alert for updating GooglePlayService
/**
* Google Play 서비스 사용 불가능 에러 다이얼로그
* */
private Dialog mGooglePlayServiceErrorDialog = null;
/**
* Google Play 서비스 버전 낮아서 업데이트하러 마켓으로 보내는 다이얼로그
* */
private AlertDialog mGooglePlayServiceUpdateDialog = null;
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;