PS1='\W \$ '
# System-wide .bashrc file for interactive bash(1) shells.
import Foundation | |
class Node { | |
var parent: Node? | |
var childrens: [Character:Node] = [:] | |
var isWord: Bool = false | |
var count: Int = 0 | |
init(parent: Node?) { | |
self.parent = parent | |
} |
import Foundation | |
func binarySearch<T: Comparable>(_ A: [T], key: T, _low: Int = 0, _high: Int = 0) -> Int? { | |
var low = _low | |
var high = _high | |
if _high == 0 { | |
high = A.count | |
} | |
while low < high { | |
let mid = low + (high - low) / 2 |
import Foundation | |
func gcd(_ p: Int, _ q: Int) -> Int { | |
return q == 0 ? p : gcd(q, p % q) | |
} | |
func lcm(_ p: Int, _ q: Int) -> Int { | |
return p / gcd(p, q) * q | |
} |
import Foundation | |
let x = 20 | |
print(x&(x-1)) // 오른쪽 비트 끄기 | |
print(x|(x+1)) // 제일 오른쪽 0의 비트 켜기 | |
print(x&(x+1)) // 뒤에 딸린 1들을 끄기 | |
print(x|(x-1)) // 뒤에 딸린 0들을 켜기 | |
print((~x)&(x+1)) // 제일 오른쪽 0만 켜고 다른 것 다 끄기 | |
print((~x)|(x-1)) // 제일 오른쪽 1만 끄고 다른 것 다 켜기 | |
print((~x)&(x-1)) // 뒤에 딸린 0들만 켜고 다른 것 다 끄기 |
#include <iostream> | |
#include <vector> | |
#include <deque> | |
using namespace std; | |
template <typename T> | |
struct Board { | |
int w; | |
int h; |
#include <iostream> | |
using namespace std; | |
int gcd(int p, int q) { | |
return q == 0 ? p : gcd(q, p % q); | |
} | |
int lcm(int p, int q) { | |
return p / gcd(p, q) * q; |
#include <iostream> | |
using namespace std; | |
struct node { | |
int key; | |
node *left; | |
node *right; | |
node *parent; | |
#include <iostream> | |
using namespace std; | |
struct node { | |
int key; | |
int size; | |
node *left; | |
node *right; | |
version: '3.2' | |
services: | |
zoo1: | |
image: zookeeper | |
restart: always | |
hostname: zoo1 | |
ports: | |
- 2181:2181 | |
environment: | |
ZOO_MY_ID: 1 |