Python

LeetCode

【LeetCode】2351. First Letter to Appear Twice 解答・解説【Python】

問題 原文 Given a string s consisting of lowercase English letters, return the first letter to appear twice. Note: ...
LeetCode

【LeetCode】300. Longest Increasing Subsequence 解答・解説【Python】

問題 原文 Given an integer array nums, return the length of the longest strictly increasing  subsequence . ...
Python

【LeetCode】413. Arithmetic Slices 解答・解説【Python】

問題 原文 An integer array is called arithmetic if it consists of at least three elements and if the difference between ...
Python

【LeetCode】62. Unique Paths 解答・解説【Python】

問題 原文 There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid). The rob...
LeetCode

【LeetCode】45. Jump Game II 解答・解説【Python】

問題 原文 You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums. Each el...
LeetCode

【LeetCode】55. Jump Game 解答・解説【Python】

問題 原文 You are given an integer array nums. You are initially positioned at the array's first index, and each element...
LeetCode

【LeetCode】17. Letter Combinations of a Phone Number 解答・解説【Python】

問題 原文 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number c...
LeetCode

【LeetCode】40. Combination Sum II 解答・解説【Python】

問題 原文 Given a collection of candidate numbers (candidates) and a target number (target), find all unique combination...
Python

Pythonでif and or elif else notなどの使い方をまとめる

Pythonの初心者向けにif文の使い方について一からまとめます。 自分でプログラムを書くときに必須になるとても大切な知識になります。 for文と並び、少しずつでも良いので必ず使えるように覚えておきましょう。 ...
Python

【Python】for文の使い方。ループ・繰り返し処理の書き方。【初心者】

ループ・繰り返し処理に使われるfor文の構造 for文を使うことで繰り返し処理を作ることができます。 for文の構造は以下のようになっています。 for 変数 in シーケンス: 繰り返し中の処理 ・ ・...