Leetcode
Leetcode 解题报告
梦逸清尘
人生苦短,我用PyTorch
展开
-
C++ sort函数自定义比较函数并调用成员变量
问题描述在我们刷LeetCode题目时,C++的sort函数可以用来对vector等容器进行排序,一个常见的需求是:我们要自定义sort使用的排序函数,且排序函数中使用除被排序容器外的其他变量。举例如下:class Solution {public: string frequencySort(string s) { unordered_map<char, int> fq; for(int i=0;i<s.length();++i)原创 2021-03-23 09:24:43 · 1267 阅读 · 0 评论 -
【Two Sum -- Easy】 三种解法
DescriptionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not u...原创 2019-12-18 23:20:03 · 186 阅读 · 0 评论