Sheldon is so bored that he started counting the number of digits used to represent the each page in the book he was reading. The pages are numbered in sequential order starting from 1.If the total number of decimal digits used is 189 can you find out the number of pages in the book ?
Kellen , Elynn and Erin have already covered all important points for excelling in a internship. Here is my 2 cents 🙂 Take notes :
Right from the day 1 take notes of
observation that you make
pseudocode of algorithms that you design
questions to ask your mentor/manager
sample test cases and expected output
software architecture
errors and its solution
important development tool commands
Split your project into several small tasks and maintain seperate note for each  task. Initially you might feel that it is unnecessary and waste of time. Trust me this will help you in a long run.
I would recommend evernote to take notes.
(A sample internship devlog notebook in evernote)
​
Track your progress :
Use progress tracking apps such as trello to classify your task into “todo, doing, done” list. Divide your task for the day into a set of small tasks and prioritize it .
​
This will give you a reality check everytime you review your progress and you will tend to plan your work accordingly.
Manage time :
During your internship it is very important to meet your deadlines. You will be expected to finish your work on time, So track your time effiiciently!
Use time management app such as Rescuetime to track what you do everyday. With so many distractions and social platforms in your digital life, it’s easy to get distracted. RescueTime helps you understand your daily habits so you can focus and be more productive. Download both chrome browser(if you use chrome) and desktop version of Rescuetime.
​
Listen to coffitivity :
If you want to concentrate on your work and stop hearing the noise around your workstation try using coffitivity. Coffitivity – Increase Your Creativity!
This is what coffitivity team describes about their app:
Research shows it’s pretty hard to be creative in a quiet space.
And a loud workplace can be frustrating and distracting.
But, the mix of calm and commotion in an environment like a coffee house is proven to be just what you need to get those creative juices flowing.
Initially I found this to be crazy and stupid idea. But pretty soon I realized how effective it was and so I used it throughout my internship period.
​
Make yourself home :
Personalize your workstation so that you will feel like home. Stick some posters or add any creative accessories and turn your boring workstation into a fun place to work.
​ My friend drew this for me 🙂 I stuck this in my workstation during my summer internship at Amazon.
Finally ,be passionate about the work you are doing and enjoy doing it.
Brute force will give you TLE even though it will pass initial test cases.
The logic behind this problem is to represent the average score x in the form of a/b where b is minimum.
We know x=a/b . First let us bring x in the form of a/b by multiplying x with pow(10,number of digits after decimal point)
Example: x=30.25 Here we multiply x with pow(10,2) so now a=3025 and b=100
Now we have to reduce the fraction a/b to its least form.
The greatest common divisor is useful for reducing fractions to be in lowest terms. For example, gcd(42, 56) = 14, therefore,
Similarly 3025/100=121*25/4*25=121/4
Now we find gcd(a,b) which is nothing but gcd(x*pow(10,numberOfDigitsAfterDecimalPoint),pow(10,numberOfDigitsAfterDecimalPoint))
FInally answer is b/gcd(a,b)
Where b =Â pow(10,numberOfDigitsAfterDecimalPoint)
a =Â x*pow(10,numberOfDigitsAfterDecimalPoint)
So ans for average score x=30.25 is 100/gcd(3025,100)=100/25=4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Link –Â http://community.topcoder.com/stat?c=problem_statement&pm=13628&rd=16278
Well, this is a simple graph problem once you get the logic !
A simple BFS traversal is enough to find the maximum x coordinate value.
A visited array is maintained to log the coordinates that are visited (inorder to avoid visiting the same point again)
First of all since John can move in any directions , he can end up in in negative coordinates also. So to represent negative coordinates as array index move origin(0,0) to (1000,1000).(transformation of coordinates. x=x+1000, y=y+1000)
On each traversal compare the x coordinate with current ans and updated it if x Value>ans
On returning the maximum x coordinate dont forget to decrement it with 1000 (inverse transformation of coordinates)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem link –Â http://codeforces.com/contest/501/problem/C
This is an interesting graph problem 🙂
Since the graph is acyclic, there will be leave(s) (with degree = 1). Identify those leaves. Consider a leaf i.Its xor value (let it be j) will directly give you its neighbour(since xor of a number is the number itself).Add (i,j) as an edge to the ans vector. Now decrement the degree of the node j and also apply xor to j’s xor sum value to remove i. After removing leaf i from the forest, the forest will still remain a forest . So similarly find the leaves in the current forest (and also the edges which is why we are doing this) and carefully prune the leaves until the forest becomes empty.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A simple DFS will do good.A 2D vector is used to represent the graph via adjacency list.
All you have to do is have a visited array to mark nodes in the graph that is already visited. Have a count variable to count the number of groups available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem link –Â http://codeforces.com/contest/501/problem/B
consider that each word(handle) goes via chain transition. initialhandle->changeinhandle->againchangeinhandle->….->finalhandle
usedmap will keep track of all currenthandle and its immediate parenthandle.
wordmap will keep track of initial and final handle of a contestant.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters