[LeetCode] Find the Peaks

2951. Find the Peaks

You are given a 0-indexed array mountain. Your task is to find all the peaks in the mountain array.

Return an array that consists of indices of peaks in the given array in any order.


  • A peak is defined as an element that is strictly greater than its neighboring elements.
  • The first and last elements of the array are not a peak.
Read more
[Codeforces] Round 225 (Div. 1) C. Propagating treeRead more
[Codeforces] Testing Round 9 C. Diverse SubstringsRead more
[Codeforces] Round 228 (Div. 1) C. Fox and Card GameRead more
[Codeforces] Round 234 (Div. 2) D. Dima and BacteriaRead more
[LeetCode] Minimum Time Visiting All Points

1266. Minimum Time Visiting All Points

On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points.

You can move according to these rules:

  • In 1 second, you can either:

    • move vertically by one unit,

      • move horizontally by one unit, or

      • move diagonally sqrt(2) units (in other words, move one unit vertically then one unit horizontally in 1 second).

  • You have to visit the points in the same order as they appear in the array.

  • You are allowed to pass through points that appear later in the order, but these do not count as visits.

Read more
[LeetCode] Find Words That Can Be Formed by Characters

1160. Find Words That Can Be Formed by Characters

You are given an array of strings words and a string chars.

A string is good if it can be formed by characters from chars (each character can only be used once).

Return the sum of lengths of all good strings in words.

Read more
[Hacker Earth] MatrixRead more
[Hacker Earth] Selection of NumbersRead more
[Hacker Earth] Array Splitting into two parts <P2SME>Read more