[AtCoder] B - 天下一リテラルRead more
[Codeforces] Round #465 (Div. 2) C. Fifa and FafaRead more
[Codeforces] Round #464 (Div. 2) C. Convenient For EverybodyRead more
[Codeforces] Round #464 (Div. 2) D. Love RescueRead more
[Codeforces] Round #466 (Div. 2) D. Alena And The HeaterRead more
[Codeforces] Round #469 (Div. 1) A. ZebrasRead more
[LeetCode] Find the Pivot Integer

2485. Find the Pivot Integer

Given a positive integer n, find the pivot integer x such that:

  • The sum of all elements between 1 and x inclusively equals the sum of all elements between x and n inclusively.

Return the pivot integer x. If no such integer exists, return -1. It is guaranteed that there will be at most one pivot index for the given input.

Read more
[LeetCode] Append Characters to String to Make Subsequence

2486. Append Characters to String to Make Subsequence

You are given two strings s and t consisting of only lowercase English letters.

Return the minimum number of characters that need to be appended to the end of s so that t becomes a subsequence of s.

A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Read more
[LeetCode] Remove Nodes From Linked List

2487. Remove Nodes From Linked List

You are given the head of a linked list.

Remove every node which has a node with a strictly greater value anywhere to the right side of it.

Return the head of the modified linked list.

Read more
[LeetCode] Count Subarrays With Median K

2488. Count Subarrays With Median K

You are given an array nums of size n consisting of distinct integers from 1 to n and a positive integer k.

Return the number of non-empty subarrays in nums that have a median equal to k.

Note:

  • The median of an array is the middle element after sorting the array in ascending order. If the array is of even length, the median is the left middle element.

    • For example, the median of [2,3,1,4] is 2, and the median of [8,4,3,5,1] is 4.
  • A subarray is a contiguous part of an array.

Read more