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

【LeetCode】637. Average of Levels in Binary Tree 解答・解説【Python】

問題 原文 Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. ...
LeetCode

【LeetCode】107. Binary Tree Level Order Traversal II 解答・解説【Python】

問題 原文 Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from ...