@ce
BAN USER- 0of 0 votes
AnswersDesign a game of Tic-Tac-Toe. Only instead of 3x3, this is a game on n x n board. Two manual players play the game. A player wins if there are all "X" or all "O" in either of n rows, n columns or 2 diagonals. What are the classes and data structure you will define? After each move/turn of a player, it is checked whether the player won the game. Minimize this time. Assume having no space constraint.
- @ce in India| Report Duplicate | Flag | PURGE
Microsoft Intern - 1of 1 vote
AnswersWith a pointer to head node of a linked list as argument, write a function to swap the consecutive elements of the list and return the head node. (Do note change values of any node, only change the links.)
- @ce in India
Example :-
1->2->3->4->5->6->7
2->1->4->3->6->5->7| Report Duplicate | Flag | PURGE
Microsoft Intern Linked Lists - 1of 1 vote
AnswersGiven an array of integers, give the most efficient algorithm to find if the array has a majority element. If the array has a majority element, find this element. (Note : The majority element is the element that occurs more than half of the size of the array)
- @ce in India| Report Duplicate | Flag | PURGE
Microsoft Intern Algorithm
best case is 2....you pick a blue ball, then you pick a green ball...that's it...this is the best case.....first two balls are of different color
- @ce October 24, 2012