LeetCode

LeetCode

【LeetCode】 350. Intersection of Two Arrays II 解答・解説【Python】

はじめに ポイント 総当たり法で解答 この記事のメリット 配列操作の初歩が学べる この記事が役立ちそうな方 配列の扱いに慣れたい方 総当たり法(brute force)から時...
LeetCode

【LeetCode】404. Sum of Left Leaves 解答・解説【Python】

問題 原文 Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A le...
LeetCode

【LeetCode】1281. Subtract the Product and Sum of Digits of an Integer 解答・解説【Python】

問題 原文 Given an integer number n, return the difference between the product of its digits and the sum of its digi...
LeetCode

【LeetCode】191. Number of 1 Bits 解答・解説【Python】

問題 原文 Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bit...
LeetCode

【LeetCode】205. Isomorphic Strings 解答・解説【Python】

問題 原文 Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the char...
LeetCode

【LeetCode】724. Find Pivot Index 解答・解説【Python】

問題 原文 Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index wher...
LeetCode

【LeetCode】1480. Running Sum of 1d Array 解答・解説【Python】

問題 原文 Given an array nums. We define a running sum of an array as runningSum = sum(nums…nums). Return the running...
LeetCode

【LeetCode】1491. Average Salary Excluding the Minimum and Maximum Salary 解答・解説【Python】

問題 原文 You are given an array of unique integers salary where salary is the salary of the ith employee. Return the...
LeetCode

【LeetCode】1523. Count Odd Numbers in an Interval Range 解答・解説【Python】

問題 原文 Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). ...
LeetCode

【LeetCode】202. Happy Number 解答・解説【Python】

問題 原文 Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following...