Posts

Showing posts from December, 2015

Adobe Interview Questions - Finding first repeating elements in a given array

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Memory_understanding {     class Reapting_elements     {         public void getfirstrepeatingelements(int[] arr)         {             int min = -1;             int element=0;             HashSet<int> set = new HashSet<int>();             for (int i = arr.Length-1; i >= 0; i--)             {                 if(set.Contains(arr[i]))                 {                     min=i;                     element=arr[i];         ...

Cerner Interview Question -- Implement Binary Search Tree

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Memory_understanding {     class Node     {         private char val;         public char Val { get; set; }         public Node leftChild;         public Node rightChild;         public Node(char value)         {             this.Val= value;             this.leftChild = null;             this.rightChild = null;         }      }     class BST_Operations     {         Node root;         public BST_Operations()         {             root = null;      ...

Tesco Interview Questions

Tesco Interview Questions using System; using System.Collections.Generic; namespace Memory_understanding {     public class UserMainCode     {         //Assume following return types while writing the code for this question.         public static int output1;         public static int letter(string input1)         {             int sum = 0;             char[] arra = input1.ToCharArray();             for (int i = 0; i < arra.Length; i++)             {                 char char_a = arra[i];                 int pos = getPosition(char_a);                 sum = sum + fib(pos);             }  ...

LinkedList Representation

Linked List Representation using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Memory_understanding {     public class Node_     {         public Node_ next;         public object data;     }     public class LinkedList     {         private Node_ head;         public void printAllNodes()         {             Node_ current=head;             while(current !=null)             {                 Console.WriteLine(current.data);                 current=current.next;             }         }         public...

Adobe Interview Questions --FullStackImplementation

Adobe Interview Questions Full Stack Implementation using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Memory_understanding {     class fullStack     {         int[] arry;         int top;         int[] stack;         int a;         public fullStack()         {             arry = new int[7];             stack = new int[7];             top = -1;         }         public void push(int element)         {             if (!isfull())             {                 arry[top+1] = element;     ...

Interfaces

 Interfaces  The below note is taken from the link below . By Vikram Chaudhary -->http://www.dotnetforall.com/why-do-we-use-interfaces-in-csharp/ Extensibility Implementation Hiding Accessing object through interfaces Loose Coupling. Before stating the discussion about the code, I would like to take you through the various components of the project as shown in the following figure InterfaceUtilization  is the client which would be using the interface components to achieve the functionality for the task. The client only contains the references for the Interfaces and Factory namespaces. Car and Driver are the assemblies which contains  the classes which implements the ICar and IDriver interfaces from the Interfaces namespace. These classes are the entities whose instances would be used to achieve the desired functionality. Interfaces is the namespace which contains the contracts or interfaces which would be in turn be implemented by the i...