![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 63
Akino_Rito
这个作者很懒,什么都没留下…
展开
-
【Python】344. Reverse String
偷懒用了Python= =终于自己实现了一次一行解决问题的美好愿望QAQ题目:Pick OneWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".解答:class Solution(object): de...原创 2018-02-19 01:24:45 · 228 阅读 · 0 评论 -
【C++】476. Number Complement
一道考察位操作和有无符号数转换的题(我的解题思路是这样的)。题目:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed t...原创 2018-02-19 01:15:00 · 219 阅读 · 0 评论 -
【C++】561. Array Partition I
通过这道题学到的新知识:std::sort可用于对C++ STL容器的排序。std::sort的声明语法:template <class RandomAccessIterator>void sort ( RandomAccessIterator first,RandomAccessIterator last );template <class RandomAccessIterat...原创 2018-02-16 22:26:33 · 206 阅读 · 0 评论 -
【C++】728. Self Dividing Numbers
两个错误:在带返回值的函数里忘记写return那一行除零问题感觉自己还远没有一个合格程序员的修养。需要再多努力才行呐。题目如下:A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 %...原创 2018-02-16 21:52:09 · 292 阅读 · 0 评论 -
【C++】617. Merge Two Binary Trees
上次写二叉树的代码可能是一年前了= =没有复习就直接上果然不是明智的想法= =题目:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You ...原创 2018-02-16 21:20:12 · 198 阅读 · 0 评论 -
【C++】657. Judge Route Circle
题目如下:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is represente...原创 2018-02-16 19:55:55 · 242 阅读 · 0 评论 -
【C++】461. Hamming Distance
首先是复习时间· C语言位操作: & 位逻辑与 | 位逻辑或 ^ 位逻辑异或 ~ 位逻辑反 >> 右移 << 左移 · GCC有一个叫做__builtin_popcount的内建函数,它可以精确的计算1的个数。因为用Dev C++作为IDE所以可以直接用。题目如下:The Hamming distance b...原创 2018-02-16 18:41:10 · 222 阅读 · 0 评论 -
【C++】771. Jewels and Stones
You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the sto...原创 2018-02-16 17:29:48 · 678 阅读 · 0 评论 -
【Java】557. Reverse Words in a String II
因为要通过空格把字符串分割成单词,所以第一反应是用Java。新学到的知识:StringBuilder和trim()trim():去掉字符串首尾的空格。String,StringBuilder以及StringBuffer这三个类之间区别主要是在两个方面,即运行速度和线程安全。题目:Given a string, you need to reverse the order of characters ...原创 2018-02-19 01:50:27 · 363 阅读 · 1 评论