Happy Coding

This blog is for my memorandum about programming and English.

Happy Coding

This blog is for my memorandum

BluteForce

57. Insert Interval(Google, LeetCode)

# Problem Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example 1:Given intervals [1,3],[6,9…

BFS 320. Generalized Abbreviation (Google, LeetCode)

Problem Write a function to generate the generalized abbreviations of a word. Example: Given word = "word", return the following list (order does not matter): ["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w…

302. Smallest Rectangle Enclosing Black Pixels

problem An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one black region. Pixels are connected horizontally and vertically. Given the location (…

累積和とってソートしてBluteForce AtCoder Regular Contest 035 B - アットコーダー王国のコンテスト事情

問題 arc035.contest.atcoder.jp note ペナルティの小さい順にソートして小さい順にペナルティをうけていけばよい。 コード

2通りの全列挙 AtCoder Regular Contest 049 B - 高橋ノルム君

Problem arc049.contest.atcoder.jp Note 想定解のやり方と違うみたい。 nこの頂点から最も遠い2組の点が最小になるようにすればよいわけで、ある2点に対して、その2点間の間にあってそれぞれの点と距離が等しくなる任意の点との距離は、 (a.c * b.c) / (a…

貪欲法による文字列操作 AtCoder Beginner Contest 009 C - 辞書式順序ふたたび

問題 abc009.contest.atcoder.jp note 文字列操作を貪欲にするだけなのだが、とても手こずった。 一番左に条件を満たす限り、一番小さい文字を持ってくるようにすればよい。

Blute Force AtCoder Beginner Contest 024 C - 民族大移動

問題 abc024.contest.atcoder.jp メモ 貪欲にやれば良いだけ