All Posts

Leetcode 1015: Smallest Integer Divisible by K

Given a positive integer k, find the length of the smallest positive integer n such that n is divisible by k, and n consists only of the digit 1. If no such number exists, return -1. Note that n might not fit into a 64-bit signed integer.

Leetcode 1027: Longest Arithmetic Subsequence

Given an array of integers, you need to return the length of the longest subsequence where the difference between consecutive elements is constant. A subsequence is derived by deleting some elements without changing the order of the remaining elements. A sequence is considered arithmetic if the difference between consecutive elements remains the same.

Leetcode 1048: Longest String Chain

You are given an array of words, where each word consists of lowercase English letters. A wordA is considered a predecessor of wordB if you can insert exactly one letter anywhere in wordA without changing the order of the other characters to make it equal to wordB. A word chain is a sequence of words such that each word is a predecessor of the next one. Your task is to find the length of the longest word chain that can be formed from the given list of words.

Leetcode 1054: Distant Barcodes

You are given an array of barcodes where each element represents a barcode. Your task is to rearrange the barcodes such that no two adjacent barcodes are the same. It is guaranteed that a solution exists, and you may return any valid rearrangement.

Leetcode 1072: Flip Columns For Maximum Number of Equal Rows

You are given an m x n binary matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., change the value of the cell from 0 to 1 or vice versa). Your task is to find the maximum number of rows that can be made equal after performing a number of column flips.

Leetcode 1079: Letter Tile Possibilities

You are given a string tiles containing uppercase English letters, where each letter represents a tile. You need to return the number of distinct non-empty sequences of letters that can be formed by selecting tiles from the string. A sequence can be formed by selecting tiles in any order and any number of times, but no tile can be used more than once in a sequence.