Given an array of integers, every element appears three times except for one. Find that singl…
分类:LeetCode
[LeetCode] Number of Digit One 数字1的个数,Number of 1 Bits 位1的个数
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than …
[LeetCode] Shortest Word Distance II 最短单词距离之二
This is a follow up of Shortest Word Distance. The only difference is now you are given …
[LeetCode] Self Crossing 自交
You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the n…
LeetCode 067 Add Binary
题目描述 Given two binary strings, return their sum (also a binary string). For example, a = “11” b = “1” Return “…
Swift LeetCode 系列之4: Median of Two Sorted Arrays(未完)
https://leetcode.com/problems/median-of-two-sorted-arrays/description/ 首先理解什么是中位数, 最简单的理解就是位置在最中间的那个数, 当数组长度为奇…
93. Restore IP Addresses
93. Restore IP Addresses 题目 Given a string containing only digits, restore it by returning all possible valid …
LeetCode | Recover Binary Search Tree
题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its s…
Leetcode 485
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1]…
产品信息格式化(3分)
题目内容: 编写一个程序, 对用户录入的产品信息进行格式化。 以下为程序的运行结果示例: Enter item number: 385↙ Enter unit price: 12.5↙ Ent…
Leetcode之989-数组形式的整数加法(Add to Array-Form of Integer)
前言 个人网站 公众号: 北京程序猿, 网站 : https://yaml.vip 算法题 题干 对于非负整数 X 而言,X 的数组形式是每位数字按从左到右的顺序形成的数组。例如,如果 X = 1231,那么其数组形式为…
[LeetCode By Go 105]112. Path Sum
题目 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the va…