LeetCode算法题-RemoveDuplicates2

LeetCode 题目:

Follow up for “Remove Duplicates”:
What if duplicates are allowed at most twice?

For example,
Given sorted array nums = [1,1,1,2,2,3],

Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3.
It doesn’t matter what you leave beyond the new length.

LeetCode URL:

https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii

阅读全文

LeetCode算法题-RemoveDuplicates

LeetCode 题目:

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.

For example,
Given input array nums = [1,1,2],

Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn’t matter what you leave beyond the new length.

LeetCode URL:

https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/

阅读全文

LeetCode算法题-RemoveElement

LeetCode 题目:

Given an array and a value, remove all instances of that value in place and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
The order of elements can be changed. It doesn’t matter what you leave beyond the new length.

Example:
Given input array nums = [3,2,2,3], val = 3

Your function should return length = 2, with the first two elements of nums being 2.

LeetCode URL:

https://leetcode.com/problems/remove-element

阅读全文

关于WePhone创始人被骗婚

几天没看新闻,今天一看,看到这事儿,被有限的内容或不完全的事实吓一跳。

虽然不知道事实究竟如何,但是从新闻和当事人的朋友爆料出来的消息里,还是能略窥一二的,期待更多事实纰漏和法律的正义。

但是,看到这个新闻我有几个感触:

(一)结婚需谨慎。
(二)生死之外无大事。
(三)软件研发工程师应该在所有场合摒弃“码农”、“屌丝”等称呼。

阅读全文