chandershivdasani
BAN USER
Use integer array to represent the number. That is how BigInteger is internally implemented in java api.
Take a look at the source code over here(Replace - by .) :
www-docjar-org/html/api/java/math/BigInteger.java.html
- Reverse the entire String
- Reverse individual words of the string
Example:
"Welcome to hell"
After step 1:
"lleh to emocleW"
After step 2:
"hell to Welcome"
Process is divided into threads and each thread gets run on different cores.
If number_of_threads <= cores, each thread gets run
if number_of_threads > cores, only subset of threads get run at a time. Thread scheduling comes into play.
Memory leak, Hardware Dependent
- chandershivdasani September 17, 2012That will fall in the case 3, where exactly one pointer points to wrong number(pointer 2 which points to odd number)
- chandershivdasani September 16, 2012memcache is nothing but a distributed hash table. A simple enough implementation of a DHT can be found at http : //dks.sics.se/jdht/index.html#example
- chandershivdasani September 15, 2012public class BlockingQueue {
private List queue = new LinkedList();
private int limit = 10;
public BlockingQueue(int limit){
this.limit = limit;
}
public synchronized void enqueue(Object item)
throws InterruptedException {
while(this.queue.size() == this.limit) {
wait();
}
//Notify all the threads that are waiting
if(this.queue.size() == 0) {
notifyAll();
}
this.queue.add(item);
}
public synchronized Object dequeue()
throws InterruptedException{
while(this.queue.size() == 0){
wait();
}
if(this.queue.size() == this.limit){
notifyAll();
}
return this.queue.remove(0);
}
}
why not return the already present hash value?
- chandershivdasani September 13, 2012For Java, all the methods inherited from the Object class
- chandershivdasani September 06, 2012SELECT *
FROM (
SELECT *
FROM employee
ORDER BY salary DESC
)
limit 10;
Stop posting same question multiple times
- chandershivdasani September 04, 2012Two trains enter from opposite directions with speed V, hence their total speed is 2V.
Time it takes for both the trains to meet: L/2V ( time = distance/speed)
Now, we need to find the distance travelled by the particle in this time. This distance = time*speed.
Distance = v*L/2V
I think what the interviewer meant was distributed cache, much like memcached or coherence. In essence, distributed cache is internally implemented using Distributed Hash Table. While implementing DHT, we need to keep in mind about CAP theorem i.e Consistency, Availability and Partition tolerance. Only two out of this three can be fulfilled at one time and depending upon your requirements, you can pick any two. I
- chandershivdasani September 04, 2012My bad! misread the question
- chandershivdasani August 28, 2012My approach:
Compute an XOR of a to z (a^b^c...z).
XOR this value with each row and column. If the row/column contains the set(a-z), this XOR will return 0.
The time complexity in this case will still be O(n*n), but we have at least removed the space complexity.
Wrote an iterative version of it:
public static int doubleFactorialIterative(int n) {
int fact=1;
int i=0;
if(n%2 == 0){
i=2;
}else {
i=1;
}
for(int j=i; j<=n; j+=2) {
fact = fact*j;
}
return fact;
}
Factorial prime:
Its a prime number that is 1 less or 1 more than a factorial.
e.g
2 (0! + 1 or 1!+1)
3(2! +1) ....
Also, what the OP meant was prime "factors" and not prime "factorials"
- chandershivdasani August 23, 2012Actually, the second part depends a lot on what you answered for part a. I think the best solution so far is the bitmap one as described by babbupandey.
- chandershivdasani August 22, 2012Are we allowed to modify the table? If yes, then the best strategy is to add an extra column column called "last_update_date". Now, you can easily query for extracting incremental records from the table.
- chandershivdasani August 22, 2012The real importance of interfaces in Java can be explained by looking at the Collections API.
Lets take an example of interface List. It defines a contract that every implementing class must implement, while giving them the independence of implementing it the way they want. The main advantage of using an interface over here as opposed to using an abstract class is that a single implementation can bind to multiple contracts.
For example, the class LinkedList implements interface Queue as well as List. If they would've been abstract class, LinkedList wouldnt have been able to extend both of them at the same time.
Another example i would like to add is interface Serializable. This is called a marker interface as it doesnt contain any method that the implementing classes needs to define. It is solely used by the JVM to identify whether the state of the class can be saved or not.
That is what external sort internally does
- chandershivdasani August 20, 2012Another way to do this is use to Parallel Processing frameworks like Map/Reduce.
- chandershivdasani August 20, 2012Yup, the second one. Look for the space
- chandershivdasani August 15, 2012The question clearly states that we dont have a pointer to head node.
At least, for the purpose of discussion, we can safely assume that n is the address of nth node and Dev's logic is correct
Reprichardcstrong, Accountant at AppPerfect
I am a modern magician, except I transform complicated technical ideas into user-friendly images before the eyes of your company ...
RepSpent high school summers donating toy monkeys in Minneapolis, MN. At the moment I'm building glue in Edison, NJ ...
Repjuliaaperez05, Cloud Support Associate at ABC TECH SUPPORT
I Performed extensive web research to collect pertinent data and gather images related to the assigned articleIts act of writing ...
RepAlmaRJude, Quality Assurance Engineer at Brocade
I am Alma from Livermore USA, I also enjoy reading – my favourite topics being social history, the development and use ...
Repannasteven1246, Analyst at Accenture
Creative, highly visual fashion professional who can brilliantly mix and match the technical expertise and intuition like fabric and color ...
Repsherrifjenkins, Applications Developer at ASAPInfosystemsPvtLtd
I am Sherri from Richmond USA. I am working as a Clinical laboratory technician worker in P. Samuels Men's ...
Repwilliamchansen95, Computer Scientist at 247quickbookshelp
I am working as a manager in Lionel Kiddie City company. I really enjoy my job. I like to play ...
Repmariawharris2, Computer Scientist at Adjetter Media Network Pvt Ltd.
Hi I am an IT Project Management Professional with 2 years' experience,Handled project development and documentation of copier rentals ...
RepDonnaWHale, Data Engineer at ADP
Hi, I am passionate writer with a BA in English from the Ohio State University.5+ years of experience writing ...
RepBlakeRileyHomes, Analyst at Aristocrat Gaming
Blake Riley Homes is the leading interior designing and real estate home staging Orange County CA company.Our professional designs ...
Rep
Reppfisterruiz, Accountant at 247quickbookshelp
Door-to-door is a canvassing technique that is generally used for sales, marketing, advertising, evangelism or campaigning, in which I walk ...
Reppedrospencerp, Blockchain Developer at 247quickbookshelp
My name is Pedro and I am a 28 years old Title abstractor . I research all documents and activities affecting ...
Repgarycsroka, Backend Developer at Axiom Sources
Hi I’m Gary, an average 19 year old in a state college who sees life as an adventure.Provide ...
If the input string is K28M then XOR with pattern(M28K) will return 0.
- chandershivdasani September 22, 2012XOR operation only cares for the characters and not their order, which is not what we want in this problem