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
// Two pointers: one input, opposite ends | |
fun twoPointers(arr: IntArray): Int { | |
var left = 0 | |
var right = arr.size - 1 | |
val ans = 0 | |
while (left < right) { | |
// do some logic here with left and right | |
if (CONDITION) { | |
left++ |
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.time.Instant | |
data class File( | |
val filename: String, | |
val size: Int, | |
val createdAt: Long? = null, | |
val ttlSec: Long? = null | |
) { | |
fun isAlive(timestamp: Long): Boolean { | |
if (ttlSec == null || createdAt == 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
[alias] | |
s = status | |
a = add | |
co = checkout | |
cm = commit -m | |
amend = commit --amend -m |