LeetCode

LeetCode

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

問題 原文 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, 2 is writte...
LeetCode

【LeetCode】3.Longest Substring Without Repeating Characters 解答・解説【Python】

問題 原文 Given a string s, find the length of the longest substring without repeating characters. Example 1: ...
LeetCode

【LeetCode】704. Binary Search 解答・解説【Python】

問題 原文 Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to...
LeetCode

【LeetCode】268. Missing Number 解答・解説【Python】

問題 原文 Given an array nums containing n distinct numbers in the range , return the only number in the range that is m...
LeetCode

【LeetCode】114. Flatten Binary Tree to Linked List 解答・解説【Python】

問題 原文 Given the root of a binary tree, flatten the tree into a "linked list": The "linked list" should use the ...
LeetCode

【LeetCode】解答前に知っておくと役に立つかもしれない情報【Python】

データ構造 LeetCodeにおける連結リストの各ノードの定義 ・解答欄にクラスが定義されている ※実際にはコメントアウトされている ・inputはリスト型に見える ・↑こちらのinputを解答欄でprintしてみると以...
LeetCode

【LeetCode】82. Remove Duplicates from Sorted List II 解答・解説【Python】

問題 原文 Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct nu...
LeetCode

【LeetCode】61. Rotate List 解答・解説【Python】

問題 原文 Given the head of a linked list, rotate the list to the right by k places. Example 1: Example 2:...
LeetCode

【LeetCode】2. Add Two Numbers 解答・解説【Python】

問題 原文 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reve...
LeetCode

【LeetCode】1232. Check If It Is a Straight Line 解答・解説【Python】

問題 原文 You are given an array coordinates, coordinates = , where  represents the coordinate of a point. Check if thes...