All Posts

Leetcode 1146: Snapshot Array

You need to implement a data structure that captures snapshots of an array and allows retrieving the value at any given index at a specific snapshot.

Leetcode 1156: Swap For Longest Repeated Character Substring

You are given a string text. You can swap two characters in the string. The task is to find the length of the longest substring with repeated characters after the swap.

Leetcode 1160: Find Words That Can Be Formed by Characters

You are given an array of strings words and a string chars. A string is considered ‘good’ if it can be formed using characters from chars where each character can be used at most once. Your task is to return the sum of the lengths of all ‘good’ strings in words.

Leetcode 1170: Compare Strings by Frequency of the Smallest Character

Define a function f(s) as the frequency of the lexicographically smallest character in a non-empty string s. For example, for s = 'abc', f(s) = 1 because the smallest character is 'a', appearing once. Given an array of strings queries and another array words, return an array where each entry corresponds to the number of strings in words where f(W) is greater than f(queries[i]) for a given i.

Leetcode 1171: Remove Zero Sum Consecutive Nodes from Linked List

Given the head of a linked list, iteratively remove all consecutive subsequences of nodes whose sum is 0. Return the modified linked list after all such subsequences have been removed. You may return any valid result.

Leetcode 1177: Can Make Palindrome from Substring

You are given a string s and an array of queries queries, where queries[i] = [lefti, righti, ki]. For each query, you can rearrange the substring s[lefti...righti] and replace up to ki characters in it with any lowercase English letters. Determine whether it is possible to form a palindrome from the resulting substring. Return an array of booleans answer where answer[i] is true if it is possible to form a palindrome for the i-th query, otherwise false.