[Codeforces] Round #775 (Div. 1, based on Moscow Open Olympiad in Informatics) A. Weird SumRead more
[Hacker Rank] Reverse Shuffle MergeRead more
[Hacker Rank] Highest Value PalindromeRead more
[Hacker Rank] Lily`s HomeworkRead more
[Hacker Rank] 3D Surface AreaRead more
[Hacker Rank] The Longest Common SubsequenceRead more
[Hacker Rank] AbbreviationRead more
[LeetCode] Maximum Absolute Sum of Any Subarray

1749. Maximum Absolute Sum of Any Subarray

You are given an integer array nums. The absolute sum of a subarray [numsl, numsl+1, …, numsr-1, numsr] is abs(numsl + numsl+1 + … + numsr-1 + numsr).

Return the maximum absolute sum of any (possibly empty) subarray of nums.

Note that abs(x) is defined as follows:

  • If x is a negative integer, then abs(x) = -x.
  • If x is a non-negative integer, then abs(x) = x.
Read more
[LeetCode] Shortest Word Distance III

245. Shortest Word Distance III

Given an array of strings wordsDict and two strings that already exist in the array word1 and word2, return the shortest distance between these two words in the list.

Note that word1 and word2 may be the same. It is guaranteed that they represent two individual words in the list.

Read more
[LeetCode] Split Linked List in Parts

725. Split Linked List in Parts

Given the head of a singly linked list and an integer k, split the linked list into k consecutive linked list parts.

The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.

The parts should be in the order of occurrence in the input list, and parts occurring earlier should always have a size greater than or equal to parts occurring later.

Return an array of the k parts.

Read more