Post, Code and Quiet Time.
  • Home
Sign in Subscribe

Bit manipulation,

A collection of 2 posts
Bit manipulation,

Next Sparse Number

Question http://www.lintcode.com/en/problem/next-sparse-number/ A number is Sparse if there are no two adjacent 1s in its binary representation. Given a number n, find the smallest Sparse number which greater than or equal to n. eg. 5 (binary representation: 101) is sparse, but 6 (binary representation:
Nov 23, 2017 1 min read
Trie,

Maximum Subarray VI

Question Given an array of integers. find the maximum XOR subarray value in given array. What's the XOR: https://en.wikipedia.org/wiki/Exclusive_or Notice Expected time complexity O(n). Answer https://threads-iiith.quora.com/Tutorial-on-Trie-and-example-problems Let's say F(L,R) is XOR of subarray from L to R.
Nov 22, 2017 1 min read
Page 1 of 1
Post, Code and Quiet Time. © 2023
Powered by Ghost