leetcode practice
need tips to solve leetcode questions. sometimes i'm just stuck on problem for a long time. how to approach to solve any kind of problem?
start with 50 easys. if you solve those quickly, then move into mediums. hards are pretty tricky tbh i just attempt then peek answers/memorize lol
This is indeed something of a problem. It is always difficult to jump into a new and large code-base. You should concentrate on any available overview documentation (e.g., explaining how it works or is structured), tutorials (e.g., showing how to make mods), and reference documentation (e.g., class references).


If you need to really dig into the source code of the library / application, then you need to find a relevant starting point. This could be something that is similar to what you want to do or modify. When you find a decent starting point, just look it up and try to understand what it does and how it works, and work your way out from there, by looking up related code (e.g., that is called within that code you are looking at, etc.). The "find in files" is definitely a central tool when exploring a code-base because it gives you an instant snapshot of where certain things are used and declared. For example, if you want to modify the behavior of class A, then there is a good chance that you will want to look at all the places where class A is used so that you can assess if your modified version will work or if you need to modify other things.


There is no doubt that doing this is hard and takes a lot of patience. I've done this several times with different code bases (some small ( < 50,000 LOCs ), some big ( > 1,000,000 LOCs )), and it's always a tedious process, especially if documentation is lacking (which it very often is). It's going to be sheer luck anyone is running that setup so try this. Break the problem down to smaller steps. If a step can't be accomplished then it's too big a step. Break it down further. Please post your code so that we can help you. if you are still facing the issue, try this its kind difficult to understand in my POV but not impossible  

imagining it while reading


can you show some codes? or samples on what you want to achive? Well.



Think about what you know about lifts.



Go with the theory of 2 lifts, one you have more than 1 lift the logic is the same you just have more options.



Lifts go 1 of 2 ways. up or down.  

A lift at floor 1 told to go up, if someone rings the bell on 3 and the lift is going there or passing there on the way up and the person said "up" on 3.. then it will stop, otherwise if its not due to stop there and the person said down, it wont. The other lift will get the job, or if both are going up, then it will be the first available lift.



Your lift needs states waiting/up/down



Your logic shouldnt be that complex, so, write down in words what your logic choices are, senarios etc



Then you should be ready to code it What problem are you facing? Post the error that you get.  

Also please edit your first post by aligning the code properly and wrap [code] tag so that it is easily understandable for us to analyze. not [full disclosure] a linux person per se.

something similar to the following should work:

https://www.unix.com/shell-programming-and-scripting/68166-converting-integer-string.html

start simple with just enough code to test the concept.

see if it works and modify/correct as necessary.

then if it still does not work, then post your documented code accordingly along an explanation of what is or is not happening as you expect or desire. hi ! dusty\_nv.

i deeply thank you for always providing the best suggestion and the best code.

if you are in trouble again, please help.

thank you. hi,

there is no one-fits-it-all framework that you can use. viktor cheng approach is good but oversimplified.  you should be flexible enough to come up with your own approaches and it comes with practice. 

i recommend the following approach:

1) start with "case in point" book - you can download this book for free everywhere. it's not the best guide on how you should approach the cases, however, it will give you the basic understanding.

2) start practicing cases with partners here or find them locally. !!! find experienced partners or coaches who can provide a good feedback!!!

3) purchase and read viktor cheng book (amazon kindle store) and listen to loms (his website). i recommend to reread the book and listen to loms every 15 cases. every time, having more experience, you’ll be finding something new.

4) practice fast math


 learn how to multiply double digit numbers (https://www.youtube.com/watch?v=6ndkkpzyjho)
 learn the division table up to 1/11 (i.e. 5/6 = 83.3)
 learn how to work with zeros (hint: 4000000 = 4*10ˆ6)
 use math tools (mimir math for ios), math tool on viktor cheng website to practice


5) below you can find a list of the most common case types and some high-level recommendations on structuring:


 market sizing - structuring from the supply or demand side. structuring using a formula or using an issue tree
 profitability - basic profitability framework. remember about different revenue streams and product mix
 market context cases (market entry, new product, acquisition, etc). always start with the big picture "market". finish with something specific to the case (e.g. how to enter?"). structure it as if you are defining the work streams for the real project.
 operational math problem (e.g. should we increase the speed of an elevator or just buy a second one? how should we reduce the queues? etc.) - structuring as a process / value chain, with inflows, operations, and outflows
 cost cutting - i provided the recommendations on structuring it here: https://www.preplounge.com/en/consulting-forum/operations-cases-mck-1105#a2134
 valuation - purely financial structure with cash flows, growth rate, wacc / hurdle rate, etc.
 synergies - revenue synergies (price, qty, mix) and cost synergies (value chain).
 social / economics cases (e.g. how to improve the quality of life in the city? how to increase the revenues of the museum?) - huge variability. practice 3-5 social cases before the interview


6) also, i would try to focus on the most common industries in the following priority(sorted by probability of getting a case): 1-retail and cpg; 2-airlines; 3-telecom; 4-banking; 5-natural resources; 6-tech

7) ! important: don't forget about the fit interview part. crafting you stories and backups stories will require a couple of weeks!

ps

here is a good list of articles regarding the different parts of the case:

1) start with clarifying questions:

https://www.preplounge.com/en/consulting-forum/clarifying-questions-1786#a3956

2) communicating while structuring. here is a long post by me on how to communicate the structure during the case study:

https://www.preplounge.com/en/consulting-forum/how-to-communicate-its-structure-for-the-case-study-1313#a2806

3) using hypothesis. i made a post about hypothesis here:

https://www.preplounge.com/en/consulting-forum/how-to-state-a-hypothesis-and-match-to-the-structure-1156#a2268

4) communicating while making calculations: 


 always tell the interviewer your approach
 check with the interviewer that your approach is correct
 come to the interviewer with some preliminary answers
 check your assumptions with the interviewer


5) communicating during the analysis of graphs / tables


 take a minute to look at the graph. read the graph title. look at the graph type and define the type (pie chart, line chart, etc). look at the legend (ask for clarifying questions if necessary). identify whats going on on the graph. look for: trends, % structures. look for unusual things - correlations, outliers,
 make 3-4 conclusions from the graph. think out loud on potential hypothesis on what could be the root cause / what are the consequences
 prioritize the most important for your current analysis and move forward with the case


6) communicating while having questions on creativity


 ask an interview for a minute to think
 think of several buckets of ideas (e.g. organic growth / non-organic growth / differentiation). remember to think as big as possible
 narrow down to each bucket and generate as many ideas as possible
 present the structure (buckets) and then your ideas


7) communicating your conclusion. you can find a good example i've posted here:

https://www.preplounge.com/en/consulting-forum/how-much-answer-first-should-the-conclusion-be-1231#a2493

8) communicating your fit stories

use the top-down approach while communicating your stories. "the pyramid principle" is the must-read by ex mckinsey on this topic.

i recommend using the star framework:


 in situation, you should briefly provide the context, usually in 1 or 2 sentences
 task usually includes 2 or 3 sentences describing the problem and your objective.
 then you provide a list of specific actions you took to achieve the goal. it should take 1 or 2 sentences per action (usually 3-4 actions). note that the interviewer can stop you any minute and ask for more details.
 the results part should have 1 or 2 sentences describing the outcomes. this part is finalizing your story - make sure it can impress the interviewer and stay in the memory.


best!