[Codeforces] Lyft Level 5 Challenge 2018 - Final Round C. Optimal Polygon PerimeterRead more
[Codeforces] Mail.Ru Cup 2018 Round 3 E. Check TranscriptionRead more
[LeetCode] Earliest Second to Mark Indices II

3049. Earliest Second to Mark Indices II

You are given two 1-indexed integer arrays, nums and, changeIndices, having lengths n and m, respectively.

Initially, all indices in nums are unmarked. Your task is to mark all indices in nums.

In each second, s, in order from 1 to m (inclusive), you can perform one of the following operations:

  • Choose an index i in the range [1, n] and decrement nums[i] by 1.
  • Set nums[changeIndices[s]] to any non-negative value.
  • Choose an index i in the range [1, n], where nums[i] is equal to 0, and mark index i.
  • Do nothing.

Return an integer denoting the earliest second in the range [1, m] when all indices in nums can be marked by choosing operations optimally, or -1 if it is impossible.

Read more
[LeetCode] Earliest Second to Mark Indices I

3048. Earliest Second to Mark Indices I

You are given two 1-indexed integer arrays, nums and, changeIndices, having lengths n and m, respectively.

Initially, all indices in nums are unmarked. Your task is to mark all indices in nums.

In each second, s, in order from 1 to m (inclusive), you can perform one of the following operations:

  • Choose an index i in the range [1, n] and decrement nums[i] by 1.
  • If nums[changeIndices[s]] is equal to 0, mark the index changeIndices[s].
  • Do nothing.

Return an integer denoting the earliest second in the range [1, m] when all indices in nums can be marked by choosing operations optimally, or -1 if it is impossible.

Read more
[LeetCode] Find the Largest Area of Square Inside Two Rectangles

3047. Find the Largest Area of Square Inside Two Rectangles

There exist n rectangles in a 2D plane. You are given two 0-indexed 2D integer arrays bottomLeft and topRight, both of size n x 2, where bottomLeft[i] and topRight[i] represent the bottom-left and top-right coordinates of the ith rectangle respectively.

You can select a region formed from the intersection of two of the given rectangles. You need to find the largest area of a square that can fit inside this region if you select the region optimally.

Return the largest possible area of a square, or 0 if there do not exist any intersecting regions between the rectangles.

Read more
[LeetCode] Split the Array

3046. Split the Array

You are given an integer array nums of even length. You have to split the array into two parts nums1 and nums2 such that:

  • nums1.length == nums2.length == nums.length / 2.
  • nums1 should contain distinct elements.
  • nums2 should also contain distinct elements.

Return true if it is possible to split the array, and false otherwise**.

Read more
[Hacker Earth] Minimizing Path CostRead more
[Hacker Earth] City and Fireman VincentRead more
[Hacker Earth] Mittal wants to go to play!Read more
[Hacker Earth] Sherlock and Special CountRead more