Basic questions about C#, OOPS, SQL, SQL SERVER, MVC, Web API, WCF, WPF, JavaScript, Jquery, .NET (CLR, CTS, GC, etc) 1 - Technical Interview: Write a program to identify whether the given input is palindrome or not, without using any existing/predefined method like sort, reverse, etc.: Use different Data structures to store and compute the result. 2- Technical Interview: Write a program to identify whether the given two inputs are Anagram or not, without using any existing/predefined method like sort, reverse, etc.: Use different Data structures to store and compute the result.
Anonymous
For the First programming question, I had used a self-made class for Linked List and a stack to compute the palindrome result. Use the Linked list to store and then copy everything into the stack you can do this together when you read the input then just traverse through the linked list from starting and check whether the stack has the same character while performing the pop operation if any of the characters do not match it means it is not a palindrome For the second question, I had used a simple Dictionary to count the occurrence of characters in both the inputs, you can use one or two dictionaries to calculate the anagram. With dictionaries, you can count the characters of each input into respective dictionaries, and later on, you can count if the characters are equal and the occurrences are also equal. If you use a single dictionary then you can count the number of characters and its count if the characters count is even for respective then the given two inputs are anagram.
Check out your Company Bowl for anonymous work chats.