Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:
其他好文 时间:
2015-07-01 11:49:06
阅读次数:
122
https://leetcode.com/problems/linked-list-cycle-ii/Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cyc...
分类:
其他好文 时间:
2015-07-01 11:48:59
阅读次数:
151
static bool IsSymmetry1(string str){ if (string.IsNullOrEmpty(str) || str.Length == 1) { return false; } for (int i = 0; i < str.Le...
分类:
编程语言 时间:
2015-07-01 11:48:31
阅读次数:
142
函数是一个具有特定功能的语句块。函数的定义使用关键字 function,语法如下:function funcName ([parameters]){ statements; [return表达式;]}函数各部分的含义:funcName为函数名。函数名可由开发者自行定义,与变量的命名规则相...
分类:
编程语言 时间:
2015-07-01 11:33:24
阅读次数:
137
情景:使用在方法中绑定数据的时候,打开链接,出现400错误。@RequestMapping(value = "editItemSubmit")
public String editItemSubmit(int id, Items item) {
itemService.updateItemFromId(id, item);
return "redirect:q...
分类:
编程语言 时间:
2015-07-01 10:15:24
阅读次数:
156
leetcode jump gameII
看了题解,用BFS是比较好的思路,一层表示当前步能到的节点,curmax表示最远的,和贪心有异曲同工之妙
class Solution {
public:
int jump(vector& a) {
int n=a.size();
if(n<=1) return 0;
int i=0, level...
分类:
其他好文 时间:
2015-07-01 10:06:40
阅读次数:
112
//统计一个数二进制中1的个数
#include
int count_one(int num)
{
int count = 0;
while (num)
{
count++;
num = num&(num - 1); //每次消去最后面的一个1,直至没有
}
return count;
}
int main()
{
printf("%d\n", count_one(12)...
分类:
编程语言 时间:
2015-07-01 10:02:35
阅读次数:
142
//不使用大小于号,求出两数最大值
#include
#include
double Max(double a, double b)
{
double q = sqrt((a-b)*(a-b));
return ((a + b) + q) / 2;
}
int main()
{
printf("(5,8)大的数为:%.0f\n", Max(5, 8));
printf("(0,4)大的...
分类:
编程语言 时间:
2015-07-01 10:02:11
阅读次数:
135
//求一个数的绝对值
#include
int absolute_value(int num)
{
if (num < 0)
{
num = ~(num - 1);
}
return num;
}
int main()
{
printf("%d\n", absolute_value(5));
printf("%d\n", absolute_value(-5));
printf(...
分类:
编程语言 时间:
2015-07-01 10:00:47
阅读次数:
559
https://leetcode.com/problems/swap-nodes-in-pairs/Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For exampl...
分类:
其他好文 时间:
2015-07-01 09:51:57
阅读次数:
99