原创 LeetCode 1240. Tiling a Rectangle with the Fewest Squares 瓷磚
Given a rectangle of size n x m, find the minimum number of integer-sided squares that tile the rectangle. Example 1:
原创 LeetCode 1153. String Transforms Into Another String 替換問題坑
Given two strings str1 and str2 of the same length, determine whether you can transform str1 into str2 by doing zero or
原创 LeetCode 340. Longest Substring with At Most K Distinct Characters 雙指針
Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Inp
原创 LeetCode 1060. Missing Element in Sorted Array 二分
Given a sorted array A of unique numbers, find the K-th missing number starting from the leftmost number of the array.
原创 LeetCode 1055. Shortest Way to Form String 字符串貪心 NextMatch數組
From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions)
原创 LeetCode 316. Remove Duplicate Letters 棧頂
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appears once and on
原创 LeetCode 418. Sentence Screen Fitting TextView自適應
Given a rows x cols screen and a sentence represented by a list of non-empty words, find how many times the given sente
原创 LeetCode 1262. Greatest Sum Divisible by Three DP坑
Given an array nums of integers, we need to find the maximum possible sum of elements of the array such that it is divi
原创 726. Number of Atoms FetchNum從字符串中Parse數
Given a chemical formula (given as a string), return the count of each atom. An atomic element always starts with an up
原创 IBM model1 推導
本文利用貝葉斯chain rule 對IBM model1模型進行了目標函數的推導與代碼層面的一些實現,僅爲學習時記錄,理解不到位情況還請批評指正 一.重要概念說明
原创 LeetCode 22. Generate Parentheses 回溯 backtrack
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, gi
原创 LeetCode 777. Swap Adjacent in LR String 不能互穿 可達性
In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurre
原创 LeetCode 642. Design Search Autocomplete System Trie樹
Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a s
原创 LeetCode 299. Bulls and Cows 位置相同/不同的個數 遍歷一趟
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to gues
原创 LeetCode 809. Expressive Words 四指針數數 簡化codes
Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". In these