Hsien Hao Weng

@Hao2000

Joined on Aug 5, 2021

  • Description Given a string s, return the longest palindromic substring in s. 給定一個String,並找出最長的回文子字串(palindromic substring),如有多個相同長度的最長子字串可只回傳一個 Example Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer.
     Like 1 Bookmark
  • Description The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a string and make this conversion given a number of rows:
     Like  Bookmark
  • Description Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). 將整數反轉,遇到超過32-bit的數就回傳0 Example Input: x = 123 Output: 321
     Like  Bookmark
  • Description Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. 給一字符串數組, 將錯位詞(指相同字符不同排列的字符串) 分組 Example Input: strs = ["eat","tea","tan","ate","nat","bat"] Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
     Like  Bookmark
  • LeetCode Two Sum Add Two Numbers Longest Substring Without Repeating Characters Longest Palindromic Substring
     Like  Bookmark
  • Description Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. 給一個整數數組,找到兩個數使得他們的和等於一個給定的數 target。 你需要實現的函數twoSum需要返回這兩個數的下標, 並且第一個下標小於第二個下標。注意這裡下標的範圍是 0 到 n-1 Example Input: nums = [2,7,11,15], target = 9
     Like  Bookmark
  • Description Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). 給定一個N叉樹,輸出這個數每個節點依照階層由左至右,由上至下 Example Input: root = [1,null,3,2,4,null,5,6] Output: [[1],[3,2,4],[5,6]]
     Like  Bookmark
  • Description Given a string s, find the length of the longest substring without repeating characters. 找出字串s中沒有重複最長的子字串(substring)的長度 Example Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3.
     Like 1 Bookmark
  • Description You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. 有兩個非空的linked list代表的整數,其中每個節點包含一個數字。數字存儲按照在原來整數中相反的順序。寫出一個函數將兩個整數相加,用linked list形式回傳兩者的合。 Example Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8]
     Like  Bookmark