[AtCoder] E - GluttonyRead more
[AtCoder] D - Water BottleRead more
[AtCoder] A - ><Read more
[Codeforces] Round #252 (Div. 2) B. Valera and FruitsRead more
[Codeforces] Round #254 (Div. 2) B. DZY Loves ChemistryRead more
[Codeforces] Round #270 C. Design Tutorial: Make It NondeterministicRead more
[Codeforces] Bayan 2015 Contest Warm Up B. Strongly Connected CityRead more
[Codeforces] Round #274 (Div. 2) B. TowersRead more
[LeetCode] Maximum Score From Removing Substrings

1717. Maximum Score From Removing Substrings

You are given a string s and two integers x and y. You can perform two types of operations any number of times.

  • Remove substring “ab” and gain x points.
  • For example, when removing “ab” from “cabxbae” it becomes “cxbae”.
  • Remove substring “ba” and gain y points.
  • For example, when removing “ba” from “cabxbae” it becomes “cabxe”.

Return the maximum points you can gain after applying the above operations on s.

Read more
[LeetCode] Finding the Number of Visible Mountains

2345. Finding the Number of Visible Mountains

You are given a 0-indexed 2D integer array peaks where peaks[i] = [xi, yi] states that mountain i has a peak at coordinates (xi, yi). A mountain can be described as a right-angled isosceles triangle, with its base along the x-axis and a right angle at its peak. More formally, the gradients of ascending and descending the mountain are 1 and -1 respectively.

A mountain is considered visible if its peak does not lie within another mountain (including the border of other mountains).

Return the number of visible mountains.

Read more