声明:纯属娱乐
目录
1.LeetCode237.删除链表中的节点
2.LeetCode535.TinURL的加密与解密
3.LeetCode50.Pow(x,n)
4.LeetCode69.x的平方根
5. LeetCode344.反转字符串
LeetCode709.转换成小写字母
LeetCode面试题53-I.在排序数组中查找数字I
class Solution {
public:
void deleteNode(ListNode* node) {
*node = *(node->next);
}
};
题目有点漏洞可以利用哈哈,直接一行代码return即可
class Solution {
public:
string encode(string longUrl) {
return longUrl;
}
string decode(string shortUrl) {
return shortUrl;
}
};
题目原意是要用反复平方法求解快速幂问题,可参见我的博客:https://blog.csdn.net/qq_41895747/article/details/104379060?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158402547219724845051720%2522%252C%2522scm%2522%253A%252220140713.130056874..%2522%257D&request_id=158402547219724845051720&biz_id=0&utm_source=distribute.pc_search_result.none-task
class Solution {
public:
double myPow(double x, int n) {
return pow(x,n);
}
};
原题意是要用迭代法求解,纯属抖个机灵
class Solution {
public:
int mySqrt(int x) {
return sqrt(x);
}
};
原题意是双指针哈哈溜了
class Solution {
public:
void reverseString(vector& s) {
reverse(s.begin(),s.end());
}
};
func toLowerCase(str string) string {
return strings.ToLower(str)
}
int search(vector& nums, int target) {
return count(nums.begin(),nums.end(),target);
}