
C#
文章平均质量分 59
再度飞越
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
删除链表中重复项
Problem Remove duplicates in a list Solution Sort the list. Loop through the list. If the elements is not equal to last elements, that means a new element using System; using System.Colle原创 2013-05-16 09:05:07 · 854 阅读 · 0 评论 -
Print the numbers of form 2^i.5^j in increasing order -- Google
Problem Print the numbers of form 2^i.5^j in increasing order. For eg: 1, 2, 4, 5, 8, 10, 16, 20 Solution /* ==================================================================原创 2013-07-04 11:30:27 · 559 阅读 · 0 评论 -
Compute the maximum of two integers without if-else
using System; namespace JamesChen { class Program { static int MaximumWithoutIf(int a, int b) { int m = a - b; m = a + (a - b) * ((a - b原创 2013-07-04 11:46:08 · 457 阅读 · 0 评论 -
Compute how many bits to require convert one integer to another
Problem Write a function to determine the number of bits required to convert integer A to integer B. Input: 31, 14 Output: 2 Solution /* =========================================原创 2013-07-04 11:32:19 · 583 阅读 · 0 评论 -
机器字节顺序
Problem Determine the endianess of a computer Solution using System; using System.Runtime.InteropServices; namespace Endianess { [StructLayout(LayoutKind.Explicit)] struct Union {原创 2013-05-14 20:14:51 · 767 阅读 · 1 评论 -
计算二项式系数
Problem Design an efficient algorithm for computing c(n, k) that has the property that it never overflows if c(n, k) can be represented as an integer assume n and k are both integers. Solution原创 2013-05-14 13:19:41 · 1123 阅读 · 0 评论 -
计算整数方根
Problem Implement a fast integer square root function that takes in a 32-bit unsigned integer and returns another 32-bit unsigned integer that is the floor of the square root of the input. Solutio原创 2013-05-14 17:27:01 · 617 阅读 · 0 评论 -
计算整数的奇偶性
Problem Compute the parity of a long integer. Solution - Erases the least significant bit of a number e.g 1111 -> 1111 & 1110 = 1110 1110 -> 1110 & 1101 = 1100 1101 -> 1101 &原创 2013-05-14 12:38:22 · 684 阅读 · 0 评论 -
找出数列中不存在的数据项
Problem Find the missing number from the list of 99 distinct numbers which are from 1-100 Solution Compute sum of the list. Compute desirable sum without missing number. The missing number is原创 2013-05-16 13:08:40 · 955 阅读 · 0 评论 -
Print an array in spiral order -- Microsoft
Problem Given an mxn matrix, design a function that will print out the contents of the matrix in spiral format. Spiral format means for a 5x5 matrix given below: [ 1 2 3 4 5 ] [ 6 7原创 2013-07-04 10:56:44 · 545 阅读 · 0 评论