LeetCode

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...
LeetCode

【LeetCode】14. Longest Common Prefix 解答・解説【Python】

LeetCodeの問題を解きます。問題文は翻訳サイトと私の拙い英語力で和訳しており、正確でない可能性が高いためご注意ください。 問題文 原文 Write a function to find the longest common pr...
LeetCode

【LeetCode】13. Roman to Integer解答・解説【Python】

LeetCodeの問題を解きます。問題文は翻訳サイトと私の拙い英語力で和訳しており、正確でない可能性が高いためご注意ください。 問題文 原文 Roman numerals are represented by seven differ...