Tuesday, February 23, 2021

Coding Interview Preparation Phases

Crawl Phase

Step 1 : Basic Concepts

Learn the basic data structures and algorithms. Learn the basic concepts and terminology to build your vocabulary of programming.

Step 2 : Code

Code the representation and operations for the data structures in your list.

Step 3 : Coding Drills

Design coding drills and practice the algorithms in your list.

Step 4 : Analyze

Analyze the time and space complexity of your code.

Step 5 : Test

Test your code using test cases. Debug and fix any bugs.

Step 6 : Take Notes

Take notes to help you review later. Learn from your mistakes.

Step 7 : Pros and Cons

After you have learned about the data structures in your list, compare the pros and cons of using similar data structures.

Walk Phase

Step 1 : Understand the Problem

Understand the problem statement before you design the algorithm.

Step 2 : Identify the Approach

Identify the data structure, algorithm and strategy to solve the problem.

Step 3 : Outline the Solution

Outline the solution at a high level.

Step 4 : Identify the Obstacles

Identify the obstacles to solving the problem. Revisit your study materials to gain a deeper understanding of the concepts. This is a top down approach to assimilation process.

Step 5 : Work Backwards

Work backwards from the solution. Design and practice coding drills. Practice coding the solution and understand the solution. This is a bottom up approach to assimilation process.

Step 6 : Test

Test your code with test cases.

Step 7 : Analyze

Analyze the time and space complexity of your solution.

Step 8 : Take Notes

Review your solution and reflect. Take notes on where you made mistakes and review your solution.

Run Phase

Step 1 : Form Links

Connect the dots between problems you solved in walk phase.

Step 2 : Problem Types

Solve problems by category.

Step 3 : Recognize Patterns

Summarize common patterns used for solving problems within the same category.

Step 4 : Take Notes

Take notes on where you made mistakes to help you review later.

Step 5 : Practice

Practice articulating your solution.

Step 6 : Evaluate Progress

Form a study group. Take mock interviews.

Customized Action Plan

I can guide you in creating a customized action plan for your situation. Sign up here https://go.oncehub.com/BalaParanj for your FREE session and we will figure it all out. Why is this free? Because I believe in Zig Ziglar's quote:

You can get everything in life you want if you will just help enough other people get what they want.

Thursday, February 11, 2021

Coding Interview Question

        # 0 1 2 3 4 5 6

input = [1,2,4,2,5,3,5]

def duplicates(input)

  hash = Hash.new(0)

  output = Hash.new([])


  input.each do |n|

    hash[n] += 1



  hash.each do |k,v|

    if v > 1

      output[k] = []

      input.each_with_index do |e, i|

        if e == k

          output[k] << i








p duplicates(input)

Saturday, January 23, 2021

Desirable Difficulty

UCLA professor Robert Bjork has argued that desirable difficulty is actually required for us to upskill and move to another level.

Consider two kinds of batting practice. In one, the pitches are chunked into categories—twenty-five fastballs, twenty-five curve balls—in a predictable rhythm. At the end of this practice, hitters reported feeling a sense of confidence and flow.

The alternative involves mixing up the pitches randomly. Here, the batters reported frustration and less satisfaction. But teacher Torre’ Mills points out that the random method, where desirable difficulty is at work, actually improves players’ skills more than the chunked approach.

Desirable difficulty is the hard work of doing hard work. Setting ourselves up for things that cause a struggle, because we know that after the struggle, we’ll be at a new level.

Learning almost always involves incompetence. Shortly before we get to the next level, we realize that we’re not yet at that level and we feel insufficient. The difficulty is real, and it’s desirable if our goal is to move forward.

When we intentionally avoid desirable difficulty, our practice suffers, because we’re only coasting.

The commitment, then, is to sign up for days, weeks, or years of serial incompetence and occasional frustration. To seek out desirable difficulty on our way to a place where our flow is actually productive in service of the change we seek to make.

Seth Godin. “The Practice.” 

Monday, January 18, 2021

Learning Environment

 Learn in a relaxed environment. The best recall occurs when brainwave patterns show a relaxed state.

Learn in a multi-sensory environment by involving visual, auditory and kinesthetic activities.

Use color! This stimulates the right brain and helps recall.

Make sure you take breaks every hour.

Try to relate what you are learning to a bigger picture.

Reinforce what you have learned through practice and review.

Saturday, January 16, 2021

Remove whitespace from file names in Unix/Mac

 Go to the folder where the files are located and run:

for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done

Thursday, January 14, 2021

Upload File to S3

 require 'aws-sdk-s3'  # v2: require 'aws-sdk'



REGION_ID = "us-east-1"

BUCKET_NAME = "bucket-name"

def uploadS3

  credentials = Aws::Credentials.new(




  s3 = Aws::S3::Client.new(

                          region: REGION_ID,

                          credentials: credentials



  #Upload export/file1.zip, export/file2.zip

  for file_name in ['file1.zip', 'file2.zip']

    name = File.join('export', file_name)

    # Upload

    File.open(name, 'rb') do |file|

      puts "start uploading #{file_name} to s3"

      resp = s3.put_object(bucket: BUCKET_NAME, acl: "public-read", key: file_name, body: file)

      puts resp


    puts "File should be available at https://#{BUCKET_NAME}.s3.amazonaws.com/#{file_name}"