This file contains hidden or 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.ArrayList; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Queue; | |
import java.util.Scanner; | |
import java.util.Set; |
This file contains hidden or 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
class History { | |
private int wormHash; | |
private History prev; | |
} |
This file contains hidden or 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
ary = [5, 4, 1, 7, 3, 8] | |
#案1 | |
p ary.each_with_index.select{|e, i| e >= 5}.map{|e| e[1]} #=>[0, 3, 5] | |
#案2 | |
p ary.each_with_index.each_with_object([]){|(e, i), acc| acc << i if e >= 5} #=>[0, 3, 5] |
This file contains hidden or 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
INF = 500 * 5000000 + 1 | |
m, n = 2.times.map{gets.chomp.to_i} | |
dp = [0] + Array.new(m, INF) | |
n.times do | |
num, cost = gets.chomp.split(/ /).map(&:to_i) | |
m.downto(1) do |j| | |
prev = j - num | |
prev = 0 if prev < 0 |
This file contains hidden or 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
<!doctype> | |
<html lang="ja"> | |
<!-- https://pocari.github.io/progress_bar/progress_bar_test.html --> | |
<head> | |
<title>progress bar demo</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> |
This file contains hidden or 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
class DirectionGenerator | |
RIGHT = [ 0, 1] | |
DOWN = [ 1, 0] | |
LEFT = [ 0, -1] | |
UP = [-1, 0] | |
def each | |
[RIGHT, DOWN, LEFT, UP].cycle.each do |dir| | |
yield dir | |
end | |
end |
This file contains hidden or 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 com.example.config; | |
import javax.sql.DataSource; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.jdbc.core.JdbcTemplate; | |
import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup; |
This file contains hidden or 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
echo 5 2 1 9 50 56 | ruby -e "puts gets.split(/\s+/).permutation.map(&:join).max" |
This file contains hidden or 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
require 'docker' | |
require 'observer' | |
class DockerEvents | |
include Observable | |
def run | |
Docker::Event.stream do |ev| | |
changed | |
notify_observers(ev) | |
end |