作者:zykBlog

链接:https://www.cnblogs.com/zykBlog

来源:https://www.cnblogs.com/zykBlog

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

11 2020 档案

摘要:class Solution { public ListNode swapPairs(ListNode head) { ListNode dummy = new ListNode(-1); ListNode p = dummy; dummy.next = head; while(p != null 阅读全文
posted @ 2020-11-09 21:08 0xcf 阅读(86) 评论(0) 推荐(0)
摘要:思路 使用队列将每个链表元素放入,每次获取最小的元素加入到链表中 实现代码 class Solution { public ListNode mergeKLists(ListNode[] lists) { Queue<ListNode> heap = new PriorityQueue<>(new 阅读全文
posted @ 2020-11-09 20:54 0xcf 阅读(83) 评论(0) 推荐(0)
摘要:总线锁机制 某个cpu要读取一个数据的时候,就会对总线加锁,只有当这个cpu释放锁之后其他CPU才可以获取数据 MESI协议 MESI,当我们修改本地内存的数据时,就会强制刷新到主内存,然后发布一个消息,其他CPU通过总线嗅探到修改的消息,就会将本地的数据标记为过期,然后下一次就会重新从内存中获取数 阅读全文
posted @ 2020-11-07 13:07 0xcf 阅读(47) 评论(0) 推荐(0)
摘要:class Solution { public: bool isPalindrome(int x) { if(x < 0) return false; if(x == 0) return true; vector<int>nums; while(x) nums.push_back(x % 10), 阅读全文
posted @ 2020-11-03 15:41 0xcf 阅读(32) 评论(0) 推荐(0)
摘要:class Solution { public: int myAtoi(string s) { if(s.empty()) return 0; // 去掉空格 int k = 0; while(s[k] == ' ') k++; bool flag = false; if(s[k] == '-') 阅读全文
posted @ 2020-11-03 15:39 0xcf 阅读(121) 评论(0) 推荐(0)
摘要:题目思路 翻转一个整数,主要注意溢出的判断 实现代码 class Solution { public: int reverse(int x) { if(!x) return x; int res = 0; while(x) { if(x > 0 && res > (INT_MAX - x % 10) 阅读全文
posted @ 2020-11-03 15:12 0xcf 阅读(36) 评论(0) 推荐(0)

作者:zykBlog

链接:https://www.cnblogs.com/zykBlog

来源:https://www.cnblogs.com/zykBlog

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

点击右上角即可分享
微信分享提示