摘要: Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.移除单链表中重复的节点public class Solution { ... 阅读全文
posted @ 2017-01-14 12:04 xiejunzhao 阅读(161) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?假设你在爬一个楼梯,该楼梯有n阶,你有两种爬法,每次爬一阶或者两阶。请问... 阅读全文
posted @ 2017-01-14 11:56 xiejunzhao 阅读(28) 评论(0) 推荐(0)
摘要: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range of a 32-bi... 阅读全文
posted @ 2017-01-14 11:56 xiejunzhao 阅读(161) 评论(0) 推荐(0)
摘要: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of the tup... 阅读全文
posted @ 2017-01-12 00:24 xiejunzhao 阅读(151) 评论(0) 推荐(0)
摘要: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit on th... 阅读全文
posted @ 2017-01-10 23:37 xiejunzhao 阅读(410) 评论(0) 推荐(0)
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000000000... 阅读全文
posted @ 2017-01-10 23:37 xiejunzhao 阅读(128) 评论(0) 推荐(0)
摘要: Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 ... 阅读全文
posted @ 2017-01-10 23:22 xiejunzhao 阅读(153) 评论(0) 推荐(0)
摘要: 十进制转二进制static void Main(string[] args) { int i = 60; string s = ""; while (i>0) { s = (i % 2).ToString() + s; i /= 2; } Console.WriteLine(Convert.ToString(60, 2));//c#转换方法 Console.WriteLine(s);}Give... 阅读全文
posted @ 2017-01-10 23:21 xiejunzhao 阅读(204) 评论(0) 推荐(0)
摘要: Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is = 0 || carry>0) { digit = carry; ... 阅读全文
posted @ 2017-01-10 23:21 xiejunzhao 阅读(174) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public int RomanCharToInt(char c) { switch (c) { ... 阅读全文
posted @ 2017-01-10 23:21 xiejunzhao 阅读(242) 评论(0) 推荐(0)