Showing posts with label Leetcode 49: group anagrams. Show all posts
Showing posts with label Leetcode 49: group anagrams. Show all posts

Saturday, March 3, 2018

Leetcode 56: Group anagrams

March 3, 2018

Introduction


I had a mock interview March 1 8:00 PM, the peer asked me to solve the group of anagrams. I remembered the conversation I had with an engineer in mock interview before, he told me that he got full score of 4 on anonymous interview platform, and then I told him that I solved the algorithm correctly over 25 minutes, but I only got 2 out of 4.

The correct solution should discuss different cases. If words are short, then it is ok to sort the words, and use sorted words as keys of anagrams. Otherwise, we can define the anagrams keys using self-defined keys.

Mock interview practice


Here is my analysis in the mock interview. 10 minutes, no coding.


Saturday, January 27, 2018

Hard level algorithm is a good choice?

January 27, 2018

Introduction


It is most important to learn something from Silicon Valley engineering culture. I am in the city of Vancouver last eight years. Last week I had 3 mock interview on interviewing.io, I learned something about mock interview the first time.

Hard level algorithm is biased


The interviewer told me that the very hard level is biased for people who have worked on the algorithm before. The interview from facebook mostly is focusing on the data structure efficient, bug-free code. Dynamic programming or string manipulation algorithm can be very hard to work on.

I had to work on group of anagrams, and then I felt so good and then spent over 25 minutes. But the interviewer gave me feedback. In order to pass his interview, the interviewee usually takes 12 minutes to go over the problem and also write the solution.

I have to work on his advice. The peer has over 500 mock interview experience so he told me the truth the facts in terms of competing for any position in top ranking start up and software companies these days in Silicon Valley, California.

Here is my mock interview practice.

Follow up 


Feb. 12, 2018

I meet a peer on mock interview platform, and then he told me that he got rating 4 out of 4 on this algorithm group of anagrams. He did talk about all four possible solutions, including short word using sorting with time complexity O(n * mlogm), m is word's length;



Saturday, February 4, 2017

Leetcode 49: group anagrams

Feb. 4, 2016

Introduction

New habit
Julia spent some time to read question on code review first thing in Saturday morning, and then she read about Leetcode 49: group anagram. After a few minutes, she did a few things in steps, first think about solution by herself, a little nervous, and then read the discussion. She quickly decided to practice the algorithm in Saturday morning, no hackerrank contest, and she could not get up at 8:00am to catch Leetcode 1.5 hour contest. 

Anagrams
Share some facts about anagrams. Julia did a lot of research on anagram recently, she answered the time complexity code review recently on algorithm Hackerrank sherlock anagrams, but no one gave her up-vote. She worked on the algorithm over a week, and spent over 10 hours to think, asked a review also. She tried twice but no one had responded to her, she knows that she need to open a new question and invite her friends JS1 to come to help. 

Leetcode vs Hackerrank
Also, Julia checked her previous Leetcode practice but she never did practice this algorithm before. She had difficulty continuously completed most of Leetcode algorithms, a few of her Chinese friends advised her to work on leetcode, after 12 months practice, she chose to work with Hackerrank starting from April 2016, her new favorite platform to practice, and also later to play Hackerrank contests, she had more fun and sense of achievements.

So, Julia did practice the algorithm using C#, and gave her answer for code review. Hopefully, this time she can get her answer to be chosen as the answer in her first time. Wishful thinking, this day may never come. Julia will open a new question based on her answer and then ask JS1's help to review the code.  

Code review sportsmanship
Most of important, she understood how code review works in 48 hours time frame. People will answer the question first, and then, a person like Julia will rush to help, because Janos is the moderator of code review, he just did make a lot of good review, Julia likes to make it complete and thorough. That is part of sportmanship Julia learned recently on code review. Haha, Julia is full of sportsmanship in her talk. She also learns from her favorite double tennis player ranking No.1 in Feb. 2017 - Bethany Mattek-Sands, she chose high-ranking player to partner with her, single player ranking Safarova is around 55.

Code review

Julia likes to conduct some study on this algorithm, study other people's solutions first, and then prepare to make the C# code best of her understanding, ask a code review on stackoverflow.com as well. 

She has weakness on work against test cases, and need to catch up more on C# as a language. So many things she likes to do in the weekend, but she needs to write some code, and get some research done on Leetcode 49 first. 

Code review link is here on stackexchange.com. She needs to walk away little bitter since the discussion is hot out there for a while (12:05pm February 5, 2017).