You have to guess the songs from pictures. Give your best try before giving up. Best of Luck.
2.
[Read more…]
by puzzler
You have to guess the songs from pictures. Give your best try before giving up. Best of Luck.
2.
[Read more…]
You have to guess the songs from WhatsApp Emoticons and smileys. If you have not tried part 1, i would recommend you to try that first, as that is easier then this one 🙂
You have to guess the songs from WhatsApp emoticons and smileys. Give your best try before giving up.
I recently came to know about twitter cards from my brother, As such twitter allows only 140 characters to tweet, but to compete with Facebook they have launched a feature called twitter cards. Basically after adding the specific twitter meta tags to your page, twitter will give an option to expand the post, after expanding the post, user will see photo, title, description with link to your site, for example visit this funnychutkule’s twitter page. This is a great feature from twitter to promote your website and in my point of view it is a must.
To know more about types of twitter cards please visits official twitter page
I have written a small Twitter card plugin to add the twitter meta tags to your website’s product page, Click here to visit official magento connect page of this twitter card plugin.
At a party, everyone shook hands with everybody else. There were 66 handshakes. How many people were at the party?
See Solution: How many people in party?Hide Solution
So total handshakes will be = (n-1) + (n-2) + (n-3) +…… 0;
= (n-1)*(n-1+1)/2 = (n-1)*n/2 = 66
= n^2 -n = 132
=(n-12)(n+11) = 0;
= n = 12 OR n =-11
-11 is ruled out so the answer is 12 persons.
Given an array of n elements, write an algorithm to rotate it right by k element without using any other array. In other words rotate an array in place.
you can have temp variable to swap two elements.
Ex:-
Initial Array: A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Rotating array A right by 3 elements should result in
A = {8, 9, 10, 1, 2, 3, 4, 5, 6, 7}
Hint: There is a trick, think before doing much of the programming 🙂
See Solution: Rotate an array by k elementsHide Solution
void rotateRight(int[] a, int k){ int length = a.length();//in C/C++ it will be given as input reverse(a, 0, length -1);//reverse whole array reverse(a, 0, k-1);//assuming 0 < k < length reverse(1, k, n-1); } void reverse(int[] a, int start, int end){ while(start < end){ swap(a, start, end); start++; end--; } } void swap(int[] a, int pos1, int pos2){ int temp = a[pos1]; a[pos1]= a[pos2]; a[pos2] = temp; } //Note: in interviews you might be asked to handle negative scenarios // like array out of bound etc.
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: Reverse a link list without using another linked listHide Solution
Node* reverse(Node* node) { if(node == null) return null; Node * prev = node; Node* curr = node->next; while(curr != null){ Node* tmp = curr->next; curr->next = prev; prev = curr; curr = temp; } return prev; }
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: Detect if there is a cycle in the linked listHide Solution
Code in C
bool isCyclePresent(Node* node){ Node* pointer1 = node; Node* pointer2 = node; while(pointer2 != null && pointer2->next!=null){ pointer1 = pointer1->next; pointer2 = pointer2->next->next; if(pointer1 == pointer2) return true; } return false; }
Or in other words Given an integer ‘n’, return a pointer to the n-th node from the end of the list.
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: find nth element from end of linked listHide Solution
Code in C/C++
Node * getNthNodeFromLast(Node * node, int n){ Node* pointer1 = node; Node* pointer2 = node; while(pointer1 != null && n > 0){ pointer1 = pointer1->next; n--; } //List does not have n nodes, so return null if(n > 0) return null; //traverse till pointer1 becomes null while(pointer1 != null){ pointer1 = pointer1->next; pointer2 = pointer2->next; } return pointer2; }
Linked list is singly linked list(there is only next pointer no previous pointer).
See Solution: Find middle element of a linked listHide Solution
Code in C/C++
Node* getMiddleElement(Node * node){ Node* pointer1 = node; Node* pointer2 = node; //traverse till pointer2 reaches end of the list or becomes null while(pointer2 != null && pointer2->next != null){ pointer1 = pointer1->next; pointer2 = pointer2->next->next; } return pointer1; }