关闭

389. Find the Difference

Q:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that ...
阅读(55) 评论(0)

283. Move Zeroes

Q:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling...
阅读(70) 评论(0)

387. First Unique Character in a String

Q:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. 问题:给定一个字符串,找出其中第一个仅出现一次的字符,若不存在返回-1。 Examples: s = "leetcode" return 0. ...
阅读(76) 评论(0)

258. Add Digits

Q:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has...
阅读(69) 评论(1)

136. Single Number

Q:Given an array of integers, every element appears twice except for one. Find that single one. 问题:给定一个整数数组,其中除了一个元素仅出现一次,其他每个元素出现了两次。找到这个仅出现一次的数。 思路:用异或符“^” ,“^”可以理解为将二进制数的对应位相加且无进位,将数组中所有数依次亦或后,...
阅读(64) 评论(0)
    个人资料
    • 访问:336次
    • 积分:57
    • 等级:
    • 排名:千里之外
    • 原创:5篇
    • 转载:0篇
    • 译文:0篇
    • 评论:1条
    文章分类
    文章存档
    最新评论