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

Round 1

Question 1: You are given a string : sfdgjdg3e67jgjyg456
                    Fetch all numbers & provide their sum. Write the code such that if there is any slight change of requirements then                      there should be minimum code change for that.

Question 2 : Remove duplicates from the array of elements.

Question 3 : Add the given 2 numbers & these numbers are so large that can't be represented by any numeric type.

Round 2

Question 1 : How to efficiently find the given alphanumeric value in the array of millions of such numbers & if not present then 
                    add it in the array.

Question 2 : Z -> 1...9
                    Find Z such that ZZ+ZZ+Z+Z+Z = 100

Question 3 : A, B , C-> 1...9
                    Find A & B such that AB*AB = CAB

Question 4 : ​Design the chess board
Then I was told by their recruiter that both the rounds are cleared & they don't have panel for next round, so I need to come again after 2-3 days. But I didnt get any response for 1 week, & when I enquired for that multiple times then I got the response that my profile is not shortlisted for further discussions. Strange...
​

Fast forward to 2022, I had one more discussion & had first coding round in which I was asked-
Implement the custom stack to get the most occurring number & if there is tie then get the number occurred last.

Thought I was not able to provide the optimal approach but with the help of interviewer I was able to give almost working code.
And the below approach was due to the help of interviewer as I was not able to think about it.
So below, I have given my way of implementation of that approach. So at least this time experience was good as interviewer
behaved well & it was not like previous experiences with ServiceNow interviews.
Please comment & suggest the better approach or implementation-
Picture
Well, I got one comment stating that I am not handing the exception when stack is empty, though I don't know what to do by handling the exception, if it happens. So one can also get the same comment during interview & believe many interviewers will be having the mindset of using either some try/catch or throw some other exception if stack is empty.
But my say is, if you are using jdk1.8+, which you will be, then why don't you use Optional here & let the client decide about the exception on his/her side.
So can have the above pop() function as shown below-
Picture
Powered by Create your own unique website with customizable templates.