PuzzlersWorld.com

  • Hacker Puzzle
  • Interview Puzzles
  • Number Puzzles
  • Maths Puzzles

Where is this guy looking?

March 22, 2015 by asinghal 6 Comments

Where is this guy looking illusion
Where is this guy looking illussion

[Read more…]

Checkout more Picture Puzzles Tags: Solved Puzzles

Guess Tamil Poet Names

March 22, 2015 by asinghal Leave a Comment

Guess these 15 tamil poet names from whatsapp empticons
Guess Tamil Poet names
[Read more…]

Checkout more Miscellaneous Tags: Unsolved Puzzles, whatsapp puzzles

Picture Puzzle – can you read it

March 21, 2015 by asinghal 1 Comment

Can you read the words in the picture ?
picture puzzles bro

[Read more…]

Checkout more Picture Puzzles Tags: Solved Puzzles

Magento Plugin for Twitter Card

December 1, 2012 by asinghal Leave a Comment

What is Twitter Card?

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.

How to install Twitter card Magento plugin from puzzlersworld?

  1. Login to your magento admin panel.
  2. Go to System->Magento Connect->Magento Connect Manage.
  3. You need to login again with the same credentials as in first step.
  4. Paste this extension key http://connect20.magentocommerce.com/community/Pw_Twittercard under Install New Extensions section and click on install.
  5. Confirm the installation once again, after installation you have to set your twitter username.

[Read more…]

Checkout more Technical Tags: Magento, Solved Puzzles

Reverse a link list without using another

November 12, 2012 by asinghal 2 Comments

How to reverse a link list without using another link list?

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

Take two pointers previous and current, increment both pointers by one till current reaches at the end of the list.

Reverse a Linked List

Reverse a Linked List

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;
}

Checkout more Interview Questions Tags: Interview, Linked List, medium, Solved Puzzles

Detect if there is a cycle in a linked list

November 4, 2012 by asinghal 1 Comment

How can you find if a given linked list has a cycle in it?

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

This can also be solved by using two pointers as we saw in Find nth element from end of linked list and Find middle element of linked list. Take two pointers pointer1 and pointer2, both pointing to head of the linked list initially, now increment pointer1 by one node and pointer2 by two nodes, If at any point of time pointer1 and pointer2 becomes equal then there is a cycle in the linked list, else pointer2 will reach end of the list and will become null eventually.

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;
}

Checkout more Interview Questions Tags: Interview, Linked List, medium, Solved Puzzles

Find nth element from end of linked list

November 4, 2012 by asinghal Leave a Comment

How to find nth element from the end of the linked list?

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

Keep two pointers pointer1 and pointer2, both pointing to head of the linked list initially. Increment pointer1 by one node till it reaches (n+1)th node. Now increment both pointers by one node till pointer1 becomes null. At this point the node which pointer2 is pointing to will be the nth node from the last.

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;
}

Checkout more Interview Questions Tags: Amazon Interview Questions, Easy, Linked List, Solved Puzzles

Find middle element of linked list

November 4, 2012 by asinghal 1 Comment

How to Find the middle element of a linked list without traversing twice ?

Linked list is singly linked list(there is only next pointer no previous pointer).

See Solution: Find middle element of a linked listHide Solution

Take two pointers both pointing to head of the linked list( pointer1 and pointer2 ). Now increment pointer1 by one node and pointer2 by two nodes at a time in a while loop till pointer 2 reaches end of the list or becomes null, at this point the node which pointer1 is pointing to will be the middle element/node of the linked list.

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;
}

Checkout more Interview Questions Tags: Easy, Interview, Solved Puzzles

Divide a triangle into n triangles

November 3, 2012 by asinghal 6 Comments

How to divide a triangle into n equal area triangles ?
See Solution: Divide a triangle into n trianglesHide Solution

For any triangle its area can be calculated using the formula base * height/2. So we can divide a triangle into n triangles of equal area by simply dividing the base into n equal parts.

Explanations :
For example to divide the triangle in the image below into 4 equal triangles, we can simply divide its base of 8cms to 4 equal parts of 2cms each and form the 4 triangles of equal area.

divide a triangle into n triangles

divide a triangle into 4 triangles of equal area

Checkout more Interview Puzzles Tags: Solved Puzzles

Swap two integer variables

November 3, 2012 by asinghal Leave a Comment

How to swap two integer variables without using the third variable ?
See Solution: Swap two integer variablesHide Solution

I know three solutions, comment if you know more šŸ™‚

Solution 1:

x = x+y;
y  = x-y;
x  = x-y;

Solution 2:

y = 2*((x+y)/2) – (x =y);

Solution 3:

x = x^y;
y = x^y;
x = x^y;

Note: However solution 1 & 2 has problem of overflow doing addition of two integers might overflow. But solution 3 will not have any such problem

Checkout more Interview Questions Tags: Easy, Interview, Solved Puzzles

  • 1
  • 2
  • 3
  • Next Page »
Submit your Puzzle

You may also like

    Categories

    • Aive hi Puzzles
    • Akbar and Birbal
    • Alphabetical Puzzles
    • Bollywood Puzzles
    • Google Code jam
    • Hindi Riddles
    • Interview Puzzles
    • Interview Questions
    • Logical Puzzles
    • Malayalam Puzzles
    • Maths Puzzles
    • Miscellaneous
    • Number Puzzles
    • Picture Puzzles
    • Riddles
    • Tamil Puzzles
    • Technical

    Social

    • View puzzlersworld’s profile on Twitter
    privacy policy

    Copyright © 2023 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in

    • Hacker Puzzle
    • Logo Puzzles
    • Optical Illusions
    • WhatsApp Puzzles
    • Picture Puzzles
    • Riddles
      ā–¼
      • Hindi Riddles
    • Bollywood Puzzles
    • Alphabetical Puzzles
    • Aive hi Puzzles
    • Interview Puzzles
    • Logical Puzzles
    • Interview Questions
      ā–¼
      • Data Structures
      • Binary Tree
      • Algorithms
      • Recursion Questions
      • Amazon Interview Questions
      • Snapdeal Interview Questions
      • Google Code jam
    • Technical
    • Akbar and Birbal
    • Number Puzzles
    • Maths Puzzles
    • Miscellaneous