[Codeforces] Round #770 (Div. 2) B. Fortune TellingRead more
[BOJ] 9240 로버트 후드Read more
[BOJ] 10254 고속도로Read more
[BOJ] 8927 SquaresRead more
[BOJ] 7420 맹독 방벽Read more
[BOJ] 2254 감옥 건설Read more
[LeetCode] Fancy Sequence

1622. Fancy Sequence

Write an API that generates fancy sequences using the append, addAll, and multAll operations.

Implement the Fancy class:

  • Fancy() Initializes the object with an empty sequence.
  • void append(val) Appends an integer val to the end of the sequence.
  • void addAll(inc) Increments all existing values in the sequence by an integer inc.
  • void multAll(m) Multiplies all existing values in the sequence by an integer m.
  • int getIndex(idx) Gets the current value at index idx (0-indexed) of the sequence modulo 109 + 7. If the index is greater or equal than the length of the sequence, return -1.
Read more
[LeetCode] 2 Keys Keyboard

650. 2 Keys Keyboard

There is only one character ‘A’ on the screen of a notepad. You can perform one of two operations on this notepad for each step:

  • Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).
  • Paste: You can paste the characters which are copied last time.

Given an integer n, return the minimum number of operations to get the character ‘A’ exactly n times on the screen.

Read more
[LeetCode] Minimum Number of Days to Make m Bouquets

1482. Minimum Number of Days to Make m Bouquets

You are given an integer array bloomDay, an integer m and an integer k.

You want to make m bouquets. To make a bouquet, you need to use k adjacent flowers from the garden.

The garden consists of n flowers, the ith flower will bloom in the bloomDay[i] and then can be used in exactly one bouquet.

Return the minimum number of days you need to wait to be able to make m bouquets from the garden. If it is impossible to make m bouquets return -1.

Read more
[BOJ] 4181 Convex HullRead more