Skip to main content

Tricks to follow while programming

1. Before start coding resolve the algorithm, The better way is to trace the logic that your mind followed already. Because on looking into the problem, your mind will give the solution. You have to know how the mind got that solution, in which way ?
2. We have to remember any time you are not going with Standard increment or decrements, you will loose the control on the flow then you have take it to your hand by using a if condition and break.
3. Here we need to talk about logical AND operator. It will not validate the second condition if the first condition fails. We effectively utilized that feature here. Suppose A && B is there. assume expression A is false, then it will not validate for B, it will go with the false result.
4. I feel we should always be strict to the boundaries, of the problem while developing the solution. 

Comments

Popular posts from this blog

Solved Jumping on the Clouds

Challenge: Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus   or  . She must avoid the thunderheads. Determine the minimum number of jumps it will take Emma to jump from her starting postion to the last cloud. It is always possible to win the game. For each game, Emma will get an array of clouds numbered   if they are safe or   if they must be avoided. For example,   indexed from  . The number on each cloud is its index in the list so she must avoid the clouds at indexes   and  . She could follow the following two paths:   or  . The first path takes  jumps while the second takes  . Function Description Complete the  jumpingOnClouds  function in the editor below. It should return th...