LeetCode

【LeetCode】 108. Convert Sorted Array to Binary Search Tree 解答・解説【Python】

問題 原文 Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced ...
LeetCode

【LeetCode】 101. Symmetric Tree 解答・解説【Python】

問題 原文 Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). ...
LeetCode

【LeetCode】 100. Same Tree 解答・解説【Python】

問題 原文 Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two bin...
LeetCode

【LeetCode】 70. Climbing Stairs 解答・解説【Python】

問題 原文 You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 step...
LeetCode

【LeetCode】67. Add Binary 解答・解説【Python】

問題 原文 Given two binary strings a and b, return their sum as a binary string. 内容 2進数の文字列a,bが与えられます。a,bの合計を2進数の文字列で返...
LeetCode

【LeetCode】58. Length of Last Word 解答・解説【Python】

問題 原文 Given a string s consisting of words and spaces, return the length of the last word in the string. A word i...
LeetCode

【LeetCode】35. Search Insert Position 解答・解説【Python】

問題 原文 Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, r...
LeetCode

【LeetCode】27.Remove Element 解答・解説【Python】

問題 原文 Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative o...
LeetCode

【LeetCode】 26. Remove Duplicates from Sorted Array 解答・解説【Python】

問題 原文 Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each uniq...
LeetCode

【LeetCode】20. Valid Parentheses 解答・解説【Python】

問題 原文 Given a string s containing just the characters '(', ')', '{', '}', '', determine if the input string is valid...