Skip to content

Instantly share code, notes, and snippets.

@tae0y
tae0y / DFS+BFS.java
Last active December 25, 2019 03:52
import java.util.Scanner;
/**
* Created by belobster on 16. 9. 9.
*/
public class NO11403 {
public static void main(String[] args)throws Exception{
G usrG = new G();
usrG.print_Result(2);
package util;
import java.util.Random;
import java.util.Scanner;
/**
* Created by belobster on 16. 11. 2.
*/
public class Randomize {
public static void main(String[] args){
@tae0y
tae0y / app.js
Created December 9, 2016 05:29
socket.io + mongodb source code
//
/**
* Module dependencies.
* https://blogs.msdn.microsoft.com/cdndevs/2014/09/19/a-chatroom-for-all-part-3-building-a-backend-with-node-mongo-and-socket-io/
*/
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
@tae0y
tae0y / goloop.go
Created May 11, 2019 04:18
gotour_loop&function
package main
import (
"fmt"
"math"
)
/**
math.Sqrt값과 비교해 0.5이내의 오차범위내 반복
연산후 정확한 값이 나오면 z가 0이 되는 것으로 종료조건을 둘 수도 있다
@tae0y
tae0y / goslice.go
Created May 11, 2019 04:46
gotour_slice exercise
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
sl := make([][]uint8, dy)
for i:=0; i<dy; i++{
sl[i] = make([]uint8, dx)
}
@tae0y
tae0y / gomap.go
Last active May 11, 2019 05:05
gotour map exercise
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
wordmap := make(map[string]int)
sarr := strings.Fields(s)
@tae0y
tae0y / goclosure.go
Created May 11, 2019 06:00
gotour fibonacci clousure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
fibo, prev, tmp := 0, 1, 0
return func() int {
tmp = fibo
@tae0y
tae0y / gocomplex.go
Created May 11, 2019 13:20
gotour complex pow
package main
import(
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
t := x
for idx:=0; idx<1000; idx++ {
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Stack;
/**
* 2020-06-14 by solar-beam
* https://programmers.co.kr/learn/courses/30/lessons/42588?language=java
* 스택/큐 연습문제, 신호는 왼쪽으로만 보낼 수 있다
* */
import java.util.PriorityQueue;
/**
* 2020-06-18 by solar-beam
* https://programmers.co.kr/learn/courses/30/lessons/42626?language=java
* 섞인 음식은 사라진다.
* */
public class Task2_heap {