- 博客(66)
- 资源 (27)
- 收藏
- 关注
转载 Turn off the rightmost set bit
reference: http://www.geeksforgeeks.org/turn-off-the-rightmost-set-bit/Problem Definition:Write a C function that unsets the rightmost set bit of an integer.Solution:Let the in
2013-06-10 09:32:51 990
转载 Multiply a given Integer with 3.5
reference: http://www.geeksforgeeks.org/multiply-an-integer-with-3-5/Problem Definition:Given a integer x, write a function that multiplies x with 3.5 and returns the integer result. Y
2013-06-10 09:32:45 935
转载 Add 1 to a given number
reference: http://www.geeksforgeeks.org/add-1-to-a-given-number/Problem Definition:Write a program to add one to a given number. You are not allowed to use operators like ‘+’, ‘-’, ‘*’
2013-06-10 09:32:41 979
转载 Next higher number with same number of set bits
reference: http://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/Problem Definition:Given a number x, find next number with same number of 1 bits in it’s binary
2013-06-10 09:32:36 1198
转载 A Boolean Array Puzzle
reference: http://www.geeksforgeeks.org/a-boolean-array-puzzle/Problem Definition:Input: A array arr[] of two elements having value 0 and 1Output: Make both elements 0.Specific
2013-06-10 09:32:31 913
转载 Smallest of three integers without comparison operators
reference: http://www.geeksforgeeks.org/smallest-of-three-integers-without-comparison-operators/Problem Definition:Write a C program to find the smallest of three integers, without usi
2013-06-10 09:32:27 938
转载 Add two numbers without using arithmetic operators
reference: http://www.geeksforgeeks.org/add-two-numbers-without-using-arithmetic-operators/Problem Definition:Write a function Add() that returns sum of two integers. The function should
2013-06-10 09:32:22 1056
转载 Swap bits in a given number
reference: http://www.geeksforgeeks.org/swap-bits-in-a-given-number/Problem Definition:Given a number x and two positions (from right side) in binary representation of x, write a functio
2013-06-10 09:32:18 1038
转载 Count total set bits in all numbers from 1 to n
reference: http://www.geeksforgeeks.org/count-total-set-bits-in-all-numbers-from-1-to-n/Problem Definition:Given a positive integer n, count the total number of set bits in binary repr
2013-06-10 09:31:56 1628
转载 Find the element that appears once
reference: http://www.geeksforgeeks.org/find-the-element-that-appears-once/Problem Definition:Given an array where every element occurs three times, except one element which occurs onl
2013-06-10 09:31:52 931
转载 Count set bits in an integer
reference: http://www.geeksforgeeks.org/count-set-bits-in-an-integer/Problem Definition:Write an efficient program to count number of 1s in binary representation of an integer.So
2013-06-09 14:12:39 1272
转载 Write an Efficient C Program to Reverse Bits of a Number
reference: http://www.geeksforgeeks.org/write-an-efficient-c-program-to-reverse-bits-of-a-number/Problem Definition:Write an Efficient C Program to Reverse Bits of a NumberSolu
2013-06-09 14:12:35 1186
转载 Check for Integer Overflow
reference: http://www.geeksforgeeks.org/check-for-integer-overflow/Problem Definition:Write a “C” function, int addOvf(int* result, int a, int b) If there is no overflow, the function pl
2013-06-09 14:12:30 1269
转载 Find the Number Occurring Odd Number of Times
reference: http://www.geeksforgeeks.org/find-the-number-occurring-odd-number-of-times/Problem Definition:Given an array of positive integers. All numbers occur even number of times excep
2013-06-09 14:12:26 1118
转载 Find the two non-repeating elements in an array of repeating elements
reference: http://www.geeksforgeeks.org/find-two-non-repeating-elements-in-an-array-of-repeating-elements/Problem Definition:Given an array in which all numbers except two are repeated o
2013-06-09 14:12:20 1175
转载 Rotate bits of a number
reference: http://www.geeksforgeeks.org/rotate-bits-of-an-integer/Problem Definition:Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits
2013-06-09 14:12:16 1063
转载 Compute the minimum or maximum of two integers without branching
reference: http://www.geeksforgeeks.org/compute-the-minimum-or-maximum-max-of-two-integers-without-branching/Problem Definition:The key idea is to incorporate the branch into one equation.
2013-06-09 14:12:13 921
转载 Compute modulus division by a power-of-2-number
reference: http://www.geeksforgeeks.org/compute-modulus-division-by-a-power-of-2-number/Problem Definition:Compute n modulo d without division(/) and modulo(%) operators, where d is a
2013-06-09 14:12:09 927
转载 Compute the integer absolute value (abs) without branching
reference: http://www.geeksforgeeks.org/compute-the-integer-absolute-value-abs-without-branching/Problem Definition:Compute the integer absolute value (abs) without branching.Solut
2013-06-09 14:12:04 1638
转载 Find whether a given number is a power of 4 or not
reference: http://www.geeksforgeeks.org/find-whether-a-given-number-is-a-power-of-4-or-not/Problem Definition:Find whether a given number is a power of 4 or not.Solution:
2013-06-09 14:12:00 1028
转载 Swap all odd and even bits
reference: http://www.geeksforgeeks.org/swap-all-odd-and-even-bits/Problem Definition:Given an unsigned integer, swap all odd bits with even bits. For example, if the given number is 23 (000
2013-06-09 14:11:40 1620
转载 Binary representation of a given number
reference: http://www.geeksforgeeks.org/binary-representation-of-a-given-number/Problem Definition:Write a program to print Binary representation of a given number.Solution:Thi
2013-06-09 14:11:36 1372
转载 Position of rightmost set bit
reference: http://www.geeksforgeeks.org/position-of-rightmost-set-bit/Problem Definition:Write a one line C function to return position of first 1 from right to left, in binary representat
2013-06-09 14:11:32 960
转载 Write one line C function to find whether a no is power of two
reference: http://www.geeksforgeeks.org/write-one-line-c-function-to-find-whether-a-no-is-power-of-two/Problem Definition:Write one line C function to find whether a no is power of two.
2013-06-09 14:11:28 955
转载 Efficient way to multiply with 7
reference: http://www.geeksforgeeks.org/efficient-way-to-multiply-with-7/Problem Definition:Figure out a way to multiply with 7 efficiently.Solution:We can multiply a number by
2013-06-09 14:11:24 871
转载 Write a C program to find the parity of an unsigned integer
reference: http://www.geeksforgeeks.org/write-a-c-program-to-find-the-parity-of-an-unsigned-integer/Problem Definition:Parity: Parity of a number refers to whether it contains an odd or
2013-06-09 14:11:19 1086
转载 Write an Efficient Method to Check if a Number is Multiple of 3
reference: http://www.geeksforgeeks.org/write-an-efficient-method-to-check-if-a-number-is-multiple-of-3/Problem Definition:The very first solution that comes to our mind is the one tha
2013-06-09 14:11:12 1176
转载 Next Power of 2
reference: http://www.geeksforgeeks.org/next-power-of-2/Problem Definition:Write a function that, for a given no n, finds a number p which is greater than or equal to n and is a power of
2013-06-09 14:11:06 2423
转载 Count number of bits to be flipped to convert A to B
reference: http://www.geeksforgeeks.org/count-number-of-bits-to-be-flipped-to-convert-a-to-b/Problem Definition:You are given two numbers A and B. Write a program to count number of bits
2013-06-09 14:10:12 981
原创 Bit manipulation
When should you use bitwise operators?Bitwise operators are used forsaving more space orsaving some time. There are also times when you need to use bitwise operators: if you're working with co
2013-06-03 11:42:00 3177 2
原创 [LeetCode]ZigZag Conversion
class Solution {//be careful with the special case//when done with coding, figure out some cases (including illegal, normal, edge cases)//to run with this solution, this will help to get a bug-free
2013-06-03 09:09:50 1114
原创 [LeetCode]Word Search
int Dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};class Solution {//DFS Find the pathpublic: void DFS(int curX, int curY, int curPos, vector>& visit, bool& OK, vector> &board, string& word ) { if(
2013-06-03 09:09:41 3411
原创 [LeetCode]Word Ladder II
class Solution { //Split the problem in three steps: // //1.build the adjacency list //2.do a BFS to get a vector> prev array. For example, prev[1] = [2, 3, 0] means we can go from (2 to 1) or (3
2013-06-03 09:09:29 2325
原创 [LeetCode]Word Ladder
class Solution {public: int ladderLength(string start, string end, unordered_set &dict) { // Start typing your C/C++ solution below // DO NOT write int main() function //BFS(because all edge i
2013-06-03 09:09:11 1271
原创 [LeetCode]Wildcard Matching
class Solution {//1. No match. Simply return false. This is the last case in the program.//2. Single match. Either *s == *p, or *p == '?'. The return value of this case depends on the //result of t
2013-06-03 09:09:05 2296
原创 [LeetCode]Validate Binary Search Tree
struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};class Solution {//hint: when involved with BST, always remember that special e
2013-06-03 09:09:00 1452 1
原创 [LeetCode]Valid Sudoku
class Solution {public: bool isValidSudoku(vector > &board) { // Start typing your C/C++ solution below // DO NOT write int main() function return CheckBlock(board) && CheckStrip(board); } b
2013-06-03 09:08:55 2441
原创 [LeetCode]Valid Parentheses
class Solution {//stackpublic: bool isValid(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function stack charStack; for (int i = 0; i < s.size(); ++i) {
2013-06-03 09:08:48 971
原创 [LeetCode]Valid Palindrome
class Solution {public: bool isPalindrome(string s) { // Start typing your C/C++ solution below // DO NOT write int main() function TransmitString(s); for (int i = 0, j = s.size()-1; i <= j;
2013-06-03 09:08:42 2579
原创 [LeetCode]Valid Number
class Solution {//finite state machine//status 1 => 小数点前面的部分//status 2 => 小数点后到'e'前面的部分//status 3 => e后面的科学计数法部分//should practice couple times morepublic: bool isNumber(const char *s) { // St
2013-06-03 09:08:28 2224 2
color transfer 颜色转化
2011-12-06
c语言DOS界面菜单式四则运算自编(菜单功能很不错宝贵资源)
2009-03-10
Vc6.0++MFC编程实例4讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例15讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例14讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例13讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例12讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例11讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例10讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例9讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例8讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例7讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例6讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例1讲解详细(宝贵资源)
2009-03-09
Vc6.0++MFC编程实例2讲解详细(宝贵资源)
2009-03-09
链表C语言实现 功能齐全
2009-03-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人