leetcode
边陲小镇的一只羊
我不是菜鸟菜鸟!!!!
展开
-
leetcode 5-6做的题
给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 说明:不要使用任何内置的库函数,如 sqrt。 示例 1: 输入:16 输出:True 示例 2: 输入:14 输出:False class Solution { public: bool isPerfectSquare(int num) { int...原创 2020-05-06 23:53:28 · 185 阅读 · 0 评论 -
leetcode 第一个只出现一次的字符
在字符串 s 中找出第一个只出现一次的字符。如果没有,返回一个单空格。 示例: s = “abaccdeff” 返回 “b” s = “” 返回 " " class Solution { public: char firstUniqChar(string str) { map<char, int> mp; for(int i = 0; i <...原创 2020-04-24 01:29:03 · 153 阅读 · 0 评论