Submitted by heartin on Sat, 11/28/2015 - 20:08
-
Write methods to implement the multiply, substract and divide operations for integers, using only the add operator.
-
Hint:
-
a + b => a + negate(b)
-
a * b => add b a times
-
x = a / b => a = bx.
-
Find the kth number such that the only prime factors are 3,5 and 7
Submitted by heartin on Fri, 11/27/2015 - 20:48
In mathematics, the sieve of Eratosthenes is an algorithm for finding all prime numbers up to any given limit.
It does so by iteratively marking as composite (i.e., not prime) the multiples of each prime, starting with the multiples of 2.
It works on the principle that all non-prime numbers are divisible by a prime number.
Submitted by heartin on Thu, 11/26/2015 - 15:42
Problems related to sequence generation and finding if an element fits in a sequence.
Problems
-
Generate the below sequence with n elements.
-
1, 10, 11, 100, 110, 111, 1000.
-
Note:
Submitted by heartin on Sun, 11/22/2015 - 20:58
LinkedHashMap extends HashMap and has a predictable iteration order.
Properties of LinkedHashMap
-
LinkedHashMap implementation maintains a doubly-linked list running through all of its entries.
-
The doubly linked list maintained by the LinkedHashMap implementation defines the iteration ordering.
-
By default, the order is the order in which keys were inserted into the map.
Submitted by heartin on Sun, 11/22/2015 - 18:22
Problem
Write a multi-threaded program to print data from four series of data in alternating order.
There are four series of data are as below:
Series 1: 0, 4, 8, 12, …
Series2: 1, 5, 9, 13, …
Series3: 2, 6, 10, 14, …