This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iconv-lite 를 이용하여 한글이 깨져서 출력될때 수정하는 방법 | |
var request = require("request"); | |
var cheerio = require('cheerio'); | |
var iconv = require('iconv-lite'); | |
var requestOptions = { method: "GET" | |
,uri: "http://news.naver.com/main/list.nhn?mode=LS2D&mid=shm&sid1=105&sid2=731" | |
,headers: { "User-Agent": "Mozilla/5.0" } | |
,encoding: null | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 수직 기둥을 기준으로 각도가 나온다고 생각하면 됨 | |
// (5, 5) : 45.0 | |
// (-5, 5) : -45.0 | |
double degree = Math.toDegrees(Math.atan2(x, y)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sdk.java; | |
import java.util.ArrayList; | |
public class TreeNode { | |
public TreeNode parent; | |
public String data; | |
public ArrayList<TreeNode> childs; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sdk.java.sort; | |
public class BubbleSort { | |
public static void main(String[] args) { | |
int[] array = { 4, 3, 2, 5, 6, 19, 23, 5, 18, 28, 8 }; | |
sort(array); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PermutationString { | |
public static void main(String[] args) { | |
permutation("abcd"); | |
} | |
public static void permutation(String str) { | |
permutation("", str); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.util.TreeSet; | |
public class Problem2255 { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int n = in.nextInt(); | |
int[] array = new int[n]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayDeque; | |
import java.util.ArrayList; | |
public class BreadthFirstSearch { | |
// 정점의 개수 | |
static int V = 5; | |
// 발견한 정점을 표시하는 배열 | |
static int[] discovered = new int[V]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# url의 파일을 유니코드 인코딩으로 읽음 | |
textFile = sc.textFile("file_url", use_unicode=True) | |
# utf-8 인코딩을 이용하여 처리 | |
counts = textFile.flatMap(lambda line: str(line.encode('utf-8')).split("\n"))\ | |
.map(lambda line: (line.split("\t")[0], 1))\ | |
.reduceByKey(lambda a, b: a + b) | |
# hdfs에 result 폴더에 저장 | |
counts.saveAsTextFile("result") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Koi_Align { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int n = in.nextInt(); | |
int[] array = new int[n]; | |
for (int i = 0; i < n; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sdk.algo; | |
import java.util.Scanner; | |
public class Koi_Align { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int n = in.nextInt(); |
OlderNewer