Nitin Agrawal
Contact -
  • Home
  • Interviews
    • Secret Receipe
    • InterviewFacts
    • Resume Thoughts
    • Daily Coding Problems
    • BigShyft
    • CompanyInterviews >
      • InvestmentBanks >
        • ECS
        • Bank Of America
        • WesternUnion
        • WellsFargo
      • ProductBasedCompanies >
        • CA Technologies
        • Model N India
        • Verizon Media
        • Oracle & GoJek
        • IVY Computec
        • Nvidia
        • ClearWaterAnalytics
        • ADP
        • ServiceNow
        • Pubmatic
        • Expedia
        • Amphora
        • CDK Global
        • CDK Global
        • Epic
        • Sincro-Pune
        • Whiz.AI
        • ChargePoint
      • ServiceBasedCompanies >
        • Altimetrik
        • ASG World Wide Pvt Ltd
        • Paraxel International & Pramati Technologies Pvt Ltd
        • MitraTech
        • Intelizest Coding Round
        • EPAM
    • Interviews Theory
  • Programming Languages
    • Java Script >
      • Tutorials
      • Code Snippets
    • Reactive Programming >
      • Code Snippets
    • R
    • DataStructures >
      • LeetCode Problems
      • AnagramsSet
    • Core Java >
      • Codility
      • Program Arguments OR VM arguments & Environment variables
      • Java Releases
      • Threading >
        • ThreadsOrder
        • ProducerConsumer
        • Finalizer
        • RaceCondition
        • Executors
        • Future Or CompletableFuture
      • Important Points
      • Immutability
      • Dictionary
      • URL Validator
    • Julia
    • Python >
      • Decorators
      • String Formatting
      • Generators_Threads
      • JustLikeThat
    • Go >
      • Tutorial
      • CodeSnippet
      • Go Routine_Channel
      • Suggestions
    • Methodologies & Design Patterns >
      • Design Principles
      • Design Patterns >
        • TemplatePattern
        • Adapter Design Pattern
        • Decorator
        • Proxy
        • Lazy Initialization
        • CombinatorPattern
        • RequestChaining
        • Singleton >
          • Singletons
  • Frameworks
    • Apache Velocity
    • Spring >
      • Spring Boot >
        • CustomProperties
        • ExceptionHandling
        • Issues
      • Quick View
    • Rest WebServices >
      • Interviews
      • Swagger
    • Cloudera BigData >
      • Ques_Ans
      • Hive
      • Apache Spark >
        • ApacheSpark Installation
        • SparkCode
        • Sample1
        • DataFrames
        • RDDs
        • SparkStreaming
        • SparkFiles
    • Integration >
      • Apache Camel
    • Testing Frameworks >
      • JUnit >
        • JUnit Runners
      • EasyMock
      • Mockito >
        • Page 2
      • TestNG
    • Blockchain >
      • Ethereum Smart Contract
      • Blockchain Java Example
    • Microservices >
      • Messaging Formats
      • Design Patterns
    • AWS >
      • Honeycode
    • Dockers >
      • GitBash
      • Issues
  • Databases
    • MySql
    • Oracle >
      • Interview1
      • SQL Queries
    • Elastic Search
  • Random issues
    • TOAD issue
    • Architect's suggestions
  • Your Views

Will keep on sharing Data Structure questions...

Below is one coding question asked around the knowledge of Data Structures.
Stacks, Queues, List, Set & Trees are the items against which you can be grilled by the interviewer along with the algorithms using these Data Structures. Here I will try to put some sample codes & you can also look the section - Coding Interviews

// Sort the stack of numbers using only one more stack
import java.util.Random;
import java.util.Stack;
public class StackSort {
 public static void main(String[] args) {
  Stack<Integer> stack1 = new Stack<>();
  int range = 1000000;
  Random random = new Random();
  for(int i = 0; i < range; i++) {
   stack1.push(random.nextInt(range));
  }
  long start = System.currentTimeMillis();
  sort(stack1);
  System.out.println("Time taken :- " + (System.currentTimeMillis()-start) + " ms");
 }
 public static void sort(Stack<Integer> stack1) {
     Stack<Integer> stack2 = new Stack<>();
     while(!stack1.isEmpty()) {
        int next = stack1.pop();
        while (!stack2.isEmpty() && next <= stack2.peek()) {
        stack1.push(stack2.pop());
      }
      stack2.push(next);
    }
    while(!stack2.isEmpty())
       stack1.push(stack2.pop());
  }
}​
Introduction to Red-Black Trees | Baeldung on Computer Science


​14 Patterns to Ace Any Coding Interview Question | HackerNoon

Powered by Create your own unique website with customizable templates.