![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
与x的日常编题
3L4s
这个作者很懒,什么都没留下…
展开
-
2018网易笔试编程题----重排数列
题目 :小易有一个长度为N的正整数数列A = {A[1], A[2], A[3]..., A[N]}。牛博士给小易出了一个难题:对数列A进行重新排列,使数列A满足所有的A[i] * A[i + 1](1 ≤ i ≤ N - 1)都是4的倍数。小易现在需要判断一个数列是否可以重排之后满足牛博士的要求。 输入描述:输入的第一行为数列的个数t(1 ≤ t ≤ 10), 接下来每两行描述一个数列A,第一行...原创 2018-04-04 11:12:58 · 202 阅读 · 0 评论 -
LeetCode Palindrome Number回文数判断
采用两种方法实现,其实时间复杂度都一样;第一种直接比较对位的数;#include<math.h> #include<iostream> using namespace std; bool isPalindrome(int x) { if (x < 0) return false; int x_len = 1; while (x /int (pow(10,x...原创 2018-04-06 14:55:32 · 166 阅读 · 2 评论 -
leetcode 143. Reorder List
#include<iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) :val(x), next(NULL) {} }; void reverse(ListNode* head); int main() { int t = 0, n = 0; ...原创 2018-04-13 20:49:51 · 130 阅读 · 0 评论 -
leetcode 55 jump game
class Solution { public: int jump(vector<int>& nums) { int distance = 0; int step = 0; int t, tmp=0,i=0; int n = nums.size(); while ( i < n ) { //记录前一个点的每个点到达的最...原创 2018-04-25 09:36:55 · 122 阅读 · 0 评论