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
    
  
  
    
  | module ProfileFormFields = %lenses( | |
| type t = { | |
| nickname: string, | |
| age: int, | |
| } | |
| ) | |
| module FormFields = %lenses( | |
| type state = { | |
| name: string, | 
  
    
      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
    
  
  
    
  | // ์ข์ ๋ถ๋ถ ๋ฌธ์์ด | |
| // ์ข์ ๋ถ๋ถ ๋ฌธ์์ด์ด๋ ์ด๋ค ๋ฌธ์์ด s์ ๋ถ๋ถ ๋ฌธ์์ด์ด๋ฉด์ ๊ฐ์ ์ํ๋ฒณ์ด ๋ ๋ฒ ์ด์ ๋ํ๋์ง ์๋ ๋ฌธ์์ด์ ๋งํฉ๋๋ค. | |
| // ์๋ฅผ๋ค์ด ์ฃผ์ด์ง ๋ฌธ์์ด์ด "abac" ์ผ ๋, ๋ถ๋ถ ๋ฌธ์์ด "a", "ab", "bac"๋ฑ์ ์๋ ๋ฌธ์์ด "abac" ์ ๋ถ๋ถ ๋ฌธ์์ด์ด๋ฉด์ | |
| // ๋ฌธ์์ด ๋ด์ ๊ฐ์ ์ํ๋ฒณ์ด ๋ ๋ฒ ์ด์ ๋ํ๋์ง ์์ผ๋ฏ๋ก ์ข์ ๋ถ๋ถ ๋ฌธ์์ด์ ๋๋ค. ๊ทธ๋ฌ๋ "aba", "abac"๋ ๋ฌธ์์ด ๋ด์ | |
| // ๊ฐ์ ์ํ๋ฒณ 'a'๊ฐ ๋ ๋ฒ ์ด์ ๋ํ๋๋ฏ๋ก ์ข์ ๋ถ๋ถ ๋ฌธ์์ด์ด ์๋๋๋ค. ๋ฌธ์์ด s๊ฐ ์ฃผ์ด์ง ๋ ์ข์ ๋ถ๋ถ ๋ฌธ์์ด์ ๊ฐ์๋ฅผ | |
| // return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. | |
| // "abac" => "a", "b", "c", "ab", "ba", "ac", "bac" | |
| // "abcd" => "a", "b", "c", "d", "ab", "bc", "cd", "abc", "bcd", "abcd" | 
  
    
      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
    
  
  
    
  | open Belt | |
| module QuadTree = { | |
| exception Invalid_Operation(string) | |
| // P(ne, nw, sw, se) | |
| type rec t = P(t, t, t, t) | White | Black | Empty | |
| let empty = () => Empty | |
| let fromString = s => | 
  
    
      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
    
  
  
    
  | open Belt | |
| module rec Board: { | |
| type rec t | |
| and coord = (row, col) | |
| and size = int | |
| and col | |
| and row | |
| let init: size => t | 
  
    
      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
    
  
  
    
  | open Belt | |
| // ๊ฐ ๋ฌธ์์ด์ ๊ฐ์ฅ ๋ท ๊ธ์๋ผ๋ฆฌ ์ ์๋ก ๋ณํํ์ฌ ๋ํ๋ค.(a) | |
| // ์ด์  ์ฐ์ฐ์ ๊ฒฐ๊ณผ๋ก ๋์ด์จ ๊ฐ 1 or 0 (b) | |
| // ๊ฒฐ๊ณผ (c) | |
| // (a + b)๊ฐ 10 ๋ฏธ๋ง์ธ ๊ฒฝ์ฐ c ์ prepend ํ๊ณ , ๋ค์ ์ฐ์ฐ(next)์ 0์ ๋๊ฒจ์ค๋ค. | |
| // (a + b)๊ฐ 10 ์ด์์ธ ๊ฒฝ์ฐ 10์ ๋บ ๊ฐ์ c์ prepend ํ๊ณ , ๋ค์ ์ฐ์ฐ(next)์ 1์ ๋๊ฒจ์ค๋ค. | |
| let toArray = s => s->Js.String2.split("") | 
  
    
      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
    
  
  
    
  | open Belt | |
| let solution = xs => { | |
| // ์ธ์ฉ ํ์๋ฅผ ๋ด๋ฆผ์ฐจ์์ผ๋ก ์ ๋ ฌํฉ๋๋ค. [3, 2, 1, ...] | |
| // g-index๊ฐ ์ ์ผ ๋์ ๊ฒฝ์ฐ, ๋ ผ๋ฌธ N๊ฐ | |
| // ์ธ์ฉ ํ์ ๋ฐฐ์ด์ ๋งจ ๋ค๋ถํฐ ํ๋์ฉ sum์ ๋น๊ตํ์ฌ, sum >= gIndex^2 ์ธ gIndex๋ฅผ ์ฐพ์ต๋๋ค. | |
| // ์ญ์ผ๋ก ์ฐพ๋ ์ด์ ๋ ์์์๋ถํฐ ์ฐพ๋ ๊ฒฝ์ฐ ์ค๊ฐ ์ดํ ๋ค์ ์กฐ๊ฑด์ ๋ง์กฑํ๊ฒ ๋๋ ๊ฒฝ์ฐ๋ฅผ ์ฐพ์ ์ ์๊ธฐ ๋๋ฌธ์ ๋๋ค. | |
| // [3, 2, 1, ...] | |
| let sorted = xs->List.fromArray->List.sort((a, b) => b - a)->List.toArray | 
  
    
      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
    
  
  
    
  | let input = Util.read_file "../input/y2021d1" |> List.map int_of_string | |
| (* let%test _ = input = ["1"] *) | |
| (* let%expect_test _ = | |
| input |> List.iter (fun s -> print_endline s); | |
| [%expect ""] *) | |
| let prevs xs = xs |> List.rev |> List.tl |> List.rev | 
  
    
      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
    
  
  
    
  | SPC | |
| SPC: find file | |
| , switch buffer | |
| . browse files | |
| : MX | |
| ; EX | |
| < switch buffer | |
| ` eval | |
| u universal arg | |
| x pop up scratch | 
  
    
      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 ( | |
| "crypto/rand" | |
| "crypto/sha256" | |
| "crypto/subtle" | |
| "encoding/base64" | |
| "strconv" | |
| "strings" | |
| "time" | |
| "golang.org/x/crypto/pbkdf2" | 
NewerOlder