Skip to content

Instantly share code, notes, and snippets.

View yojkim's full-sized avatar

Yongjae Kim yojkim

View GitHub Profile
public class SomePublicClass {}
internal class SomeInternalClass {}
fileprivate class SomeFilePrivateClass {}
private class SomePrivateClass {}
public var somePublicVariable = 0
internal let someInternalConstant = 0
fileprivate func someFilePrivateFunction() {}
private func somePrivateFunction() {}
class SomeInternalClass {} // implicitly internal
let someInternalConstant = 0 // implicitly internal
public class SomePublicClass { // explicitly public class
public var somePublicProperty = 0 // explicitly public class member
var someInternalProperty = 0 // implicitly internal class member
fileprivate func someFilePrivateMethod() {} // explicitly file-private class member
private func somePrivateMethod() {} // explicitly private class member
}
class SomeInternalClass { // implicitly internal class
var someInternalProperty = 0 // implicitly internal class member
fileprivate func someFilePrivateMethod() {} // explicitly file-private class member
// Objective-C , iOS 8 이상
TestViewController* vc = [[TestViewController alloc] init];
vc.providesPresentationContextTransitionStyle = YES;
vc.definesPresentationContext = YES;
[vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
[self.navigationController presentViewController:vc animated:NOcompletion:nil];
var a [4]int
a[0] = 1
i := a[0]
// i == 1
// a[2] == 0, the zero value of the int type
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func searchTree(node *TreeNode, sum int, target int) [][]int {
func asteroidCollision(asteroids []int) []int {
if len(asteroids) <= 1 {
return asteroids
}
last := []int{asteroids[0]}
for _, ast := range asteroids[1:] {
for {
if len(last) == 0 {
last = append(last, ast)
func uniquePathsWithObstacles(obstacleGrid [][]int) int {
if obstacleGrid[0][0] == 1 || obstacleGrid == nil {
return 0
}
obstacleGrid[0][0] = 1
maxX := len(obstacleGrid[0])
maxY := len(obstacleGrid)
for i:=1; i<maxY; i++ {
func topKFrequent(nums []int, k int) []int {
cnt := make(map[int]int)
idx := make(map[int]int)
res := []int{}
for _, x := range nums {
cnt[x]++
if cnt[x] != 1 {
moveTo := -1
for i:=idx[x]-1; i>=0; i-- {