tag:blogger.com,1999:blog-77951539224995677582024-03-02T06:37:03.016+05:30Software Engineer Interview ExperienceThe top blog for all your media and study needsBlaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.comBlogger187125tag:blogger.com,1999:blog-7795153922499567758.post-30291034046089643862021-11-07T10:25:00.004+05:302021-11-07T10:25:47.891+05:30TCS Test<h2 style="text-align: left;"><u>TCS Test Sample Questions</u></h2><div class="separator" style="clear: both; text-align: center;"><a href="https://mma.prnewswire.com/media/1477373/TCS_Logo.jpg?p=facebook" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="419" data-original-width="800" height="168" src="https://mma.prnewswire.com/media/1477373/TCS_Logo.jpg?p=facebook" width="320" /></a></div>Below are the question pattern asked <br /><div><ul style="text-align: left;"><li>Verbal Ability - 20 Questions<br /></li><li>Numerical Ability - 15 Questions<br /></li><li>Reasoning Ability - 15 Questions</li><li>Hands On Coding Exercise - 2 Questions<br /></li></ul><p><br /></p><p><b>Sample Coding Questions</b></p><p><b>Question1</b></p><p>Given a number, return UNO if sum of its digits its recursively ends up into 1 else NOT UNO</p><p><a href="https://www.codepile.net/pile/W6ZKllOA" target="_blank">Solution</a><br /></p><p><br /><span></span></p><a name='more'></a><p></p><p><b>Question2</b></p><p>Aircrafts are equipped with auto pilot system. One of the input is a string of literal containing the direction.<br />Find if the jet plane returns to the same position on the base where it took off.<br /><br />Each direction changes at an interval of 1 min (1 <= i <= N), where N is number of directions (N, W, E, S)<br />Output "Returned successfully" if the plane returns to the starting position else "Not returned successfully"<br /><br />Example1<br />NESW<br />Returned successfully<br /><br />Example2<br />NNWESW<br />Not returned successfully</p><p><a href="https://www.codepile.net/pile/Ejvx5dmr" target="_blank">Solution</a></p></div>Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-23677061419703249692021-10-06T11:47:00.003+05:302021-10-06T11:47:27.709+05:30Apple Hacker Rank Test<h2 style="text-align: left;"><u>Apple Hacker Rank Test</u></h2><h2 style="text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://is3-ssl.mzstatic.com/image/thumb/Purple71/v4/a7/5a/54/a75a54f1-db0c-3ebc-f14a-eb6bb3b7501f/iMessage_App_Icon-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-181-0-0-0-0.png/1024x768.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Apple Hacker Rank" border="0" data-original-height="600" data-original-width="800" height="240" src="https://is3-ssl.mzstatic.com/image/thumb/Purple71/v4/a7/5a/54/a75a54f1-db0c-3ebc-f14a-eb6bb3b7501f/iMessage_App_Icon-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-181-0-0-0-0.png/1024x768.jpg" title="Apple Hacker Rank" width="320" /></a></div></h2><div style="text-align: left;">Apple Hacker Rank Test</div><div style="text-align: left;"><br /><b>Q1 Connected Numbers</b></div><div style="text-align: left;"><br />Numbers a and b are referred to as connected numbers if the digits in a can be replaced to get digits in b.</div><div style="text-align: left;">All occurrences of a digit must be converted at once. No two digits can be converted to the same digit.</div><div style="text-align: left;">If such a conversion is possible, print the minimum number of moves required for the conversion else print "Impossible".</div><div style="text-align: left;"><br />Example1</div><div style="text-align: left;">Input</div><div style="text-align: left;">11223344 55227788</div><div style="text-align: left;"><br />Output: 3</div><div style="text-align: left;"><br />Explaination</div><div style="text-align: left;">Convert 1 to 5 -> 55223344</div><div style="text-align: left;">Convert 3 to 7 -> 55227744</div><div style="text-align: left;">Convert 4 to 8 -> 55227788</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Example2</div><div style="text-align: left;">Input</div><div style="text-align: left;">1234 2334</div><div style="text-align: left;"><br />Output: 2</div><div style="text-align: left;"><br />Explaination</div><div style="text-align: left;">Convert 1 to 2 -> 2234</div><div style="text-align: left;">Convert 2 to 3 -> 2334<span><a name='more'></a></span></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><b>Q2 Frog in field can just to 6 different positions</b></div><div style="text-align: left;">2 up 1 left</div><div style="text-align: left;">2 up 1 right</div><div style="text-align: left;">2 down 1 left</div><div style="text-align: left;">2 down 1 right</div><div style="text-align: left;">2 left</div><div style="text-align: left;">2 right</div><div style="text-align: left;"><br />Find minimum moves to reach insect.</div><div style="text-align: left;"><br />Input</div><div style="text-align: left;">7 (dimension)</div><div style="text-align: left;">6 6 0 1 start (i, j) end (k, l)</div><div style="text-align: left;"><br />Output </div><div style="text-align: left;">4</div><div style="text-align: left;"><br /><a href="https://dausel.co/6rJOuw" rel="nofollow" target="_blank">Min Steps Reach Target Knight</a><br /></div>Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-13611160251493074442021-04-24T21:10:00.004+05:302021-05-09T19:09:22.881+05:30Myntra Interview Experience<h2 style="text-align: left;"><u>Myntra Software Engineer Interview Experience</u></h2>
<div style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTL1UWajf7z0XlOg8Tn19dNwcdy-wvny26gsQ&usqp=CAU" style="margin-left: 1em; margin-right: 1em;"><img alt="Myntra Software Engineer Interview Experience" border="0" data-original-height="126" data-original-width="401" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTL1UWajf7z0XlOg8Tn19dNwcdy-wvny26gsQ&usqp=CAU" title="Myntra Software Engineer" /></a>
</div>
<u><b>Round 1 - Problem Solving</b></u>
</div>
<p>
Q1: Class room; number of student 1 to N.<br />We need to elect class leader
such that<br />* Every student should trust L<br />* L shouldn’t trust
anyone.<br />(x, y) => x trusts y
</p>
<p>
Input: N integer<br />Array pair of ints<br />Output: Integer = L<br />(1,
4) (1,2) (2, 4) (3, 4) (1,2), (3, 2)
</p>
<p>Edge cases</p>
<p>(1,2), (2, 3), (1,3), (3, 2)</p>
<p>(4, 1), (1, 4), (2, 4) (3, 4)</p>
<!--HTML generated using hilite.me-->
<div style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; border-color: gray; border-image: none 100% / 1 / 0 stretch; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: medium solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table>
<tbody>
<tr>
<td>
<pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</pre>
</td>
<td>
<pre style="line-height: 125%; margin: 0px;">TrustPairNode <span style="color: #333333;">{</span>
Integer key<span style="color: #333333;">;</span> <span style="color: #888888;">//student</span>
Integer value<span style="color: #333333;">;</span><span style="color: #888888;">//trust on student</span>
<span style="color: #333333;">}</span>
Int <span style="color: #0066bb; font-weight: bold;">getLeader</span><span style="color: #333333;">(</span>List<span style="color: #333333;"><</span>TrustPairNode<span style="color: #333333;">></span> trustPair<span style="color: #333333;">,</span> <span style="color: #333399; font-weight: bold;">int</span> n<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
Map<span style="color: #333333;"><</span>Integer<span style="color: #333333;">,</span> Integer<span style="color: #333333;">></span> leaderMap <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> HashMap<span style="color: #333333;"><>();</span>
<span style="color: #008800; font-weight: bold;">for</span> <span style="color: #333333;">(</span>TrustPairNode node <span style="color: #333333;">:</span> trustPair<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #888888;">// 4 -> 3</span>
leaderMap<span style="color: #333333;">.</span><span style="color: #0000cc;">put</span><span style="color: #333333;">(</span>node<span style="color: #333333;">.</span><span style="color: #0000cc;">value</span><span style="color: #333333;">,</span> leaderMap<span style="color: #333333;">.</span><span style="color: #0000cc;">getOrDefault</span><span style="color: #333333;">(</span>node<span style="color: #333333;">.</span><span style="color: #0000cc;">value</span><span style="color: #333333;">,</span> <span style="color: #0000dd; font-weight: bold;">0</span><span style="color: #333333;">)++);</span>
<span style="color: #888888;">// (1, 4) (1, 2) (2, 4) (3, 4) (1,2), (3, 2) (5, 4)</span>
If <span style="color: #333333;">(</span>leaderMap<span style="color: #333333;">.</span><span style="color: #0000cc;">containsKey</span><span style="color: #333333;">(</span>node<span style="color: #333333;">.</span><span style="color: #0000cc;">key</span><span style="color: #333333;">))</span> <span style="color: #333333;">{</span>
leaderMap<span style="color: #333333;">.</span><span style="color: #0000cc;">remove</span><span style="color: #333333;">(</span>node<span style="color: #333333;">.</span><span style="color: #0000cc;">key</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">for</span> <span style="color: #333333;">(</span>Map<span style="color: #333333;">.</span><span style="color: #0000cc;">Entry</span><span style="color: #333333;"><</span>Integer<span style="color: #333333;">,</span> Integer<span style="color: #333333;">></span> entrySet <span style="color: #333333;">:</span> leaderMap<span style="color: #333333;">.</span><span style="color: #0000cc;">entrySet</span><span style="color: #333333;">())</span> <span style="color: #333333;">{</span>
If <span style="color: #333333;">(</span>entry<span style="color: #333333;">.</span><span style="color: #0000cc;">getValue</span><span style="color: #333333;">()</span> <span style="color: #333333;">==</span> n<span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #008800; font-weight: bold;">return</span> entry<span style="color: #333333;">.</span><span style="color: #0000cc;">getKey</span><span style="color: #333333;">();</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #333333;">-</span><span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">;</span>
<span style="color: #333333;">}</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p> <span></span></p><a name='more'></a><p></p>
<p>
Q2: Field which is walled - of different heights<br />[2, 0, 2] => 2<br />Input:
array<br />output : integer -> water stored in field.
</p>
<p><a href="https://dausel.co/HHu1bW" target="_blank">Solution</a><br /></p>
<p>
<u><b>Round 2: Data Structures & Algorithms</b></u>
</p>
<p>Q1. Get minimum element from stack in 0(1)</p>
<p> </p>
<!--HTML generated using hilite.me--><div style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; border-color: gray; border-image: none 100% / 1 / 0 stretch; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: medium solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"><table><tbody><tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</pre></td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">MinStack</span> <span style="color: #333333;">{</span>
Stack stack<span style="color: #333333;">;</span>
Stack minStack<span style="color: #333333;">;</span>
Void <span style="color: #0066bb; font-weight: bold;">push</span><span style="color: #333333;">(</span><span style="color: #333399; font-weight: bold;">int</span> element<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
If <span style="color: #333333;">(</span>minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">isEmpty</span><span style="color: #333333;">()</span> <span style="color: #333333;">||</span> element <span style="color: #333333;"><</span> minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">peek</span><span style="color: #333333;">())</span> <span style="color: #333333;">{</span>
minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">push</span><span style="color: #333333;">(</span>element<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span> <span style="color: #008800; font-weight: bold;">else</span> <span style="color: #333333;">{</span>
minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">push</span><span style="color: #333333;">(</span>minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">peek</span><span style="color: #333333;">());</span>
<span style="color: #333333;">}</span>
stack<span style="color: #333333;">.</span><span style="color: #0000cc;">push</span><span style="color: #333333;">(</span>element<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
Int <span style="color: #0066bb; font-weight: bold;">pop</span><span style="color: #333333;">()</span> <span style="color: #333333;">{</span>
<span style="color: #888888;">// if stack is empty check</span>
minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">pop</span><span style="color: #333333;">();</span>
Return stack<span style="color: #333333;">.</span><span style="color: #0000cc;">pop</span><span style="color: #333333;">();</span>
<span style="color: #333333;">}</span>
Int <span style="color: #0066bb; font-weight: bold;">getMinimum</span><span style="color: #333333;">()</span> <span style="color: #333333;">{</span>
<span style="color: #888888;">// if stack is empty</span>
Return minStack<span style="color: #333333;">.</span><span style="color: #0000cc;">peek</span><span style="color: #333333;">();</span>
<span style="color: #333333;"><span> </span>}</span>
<span style="color: #333333;">}</span>
</pre></td></tr></tbody></table></div>
<p> <br /></p>
<p>
Q2 A number can be broken into different sub-sequence parts. Suppose, a number
3245 can be broken into parts like 3 2 4 5 32 24 45 324 245 3245. And this
number is a colorful number, since product of every digit of a sub-sequence
are different. That is, 3 2 4 5 (3*2)=6 (2*4)=8 (4*5)=20 (3*2*4)= 24 (2*4*5)=
40</p><p> <br /></p><!--HTML generated using hilite.me--><div style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; border-color: gray; border-image: none 100% / 1 / 0 stretch; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: medium solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"><table><tbody><tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28</pre></td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">private</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">printColorful</span><span style="color: #333333;">(</span>String number<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
Set<span style="color: #333333;"><</span>String<span style="color: #333333;">></span> numSet <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> HashSet<span style="color: #333333;"><>();</span>
<span style="color: #008800; font-weight: bold;">for</span> <span style="color: #333333;">(</span><span style="color: #333399; font-weight: bold;">int</span> i<span style="color: #333333;">=</span><span style="color: #0000dd; font-weight: bold;">0</span><span style="color: #333333;">;</span> i<span style="color: #333333;"><</span>number<span style="color: #333333;">.</span><span style="color: #0000cc;">length</span><span style="color: #333333;">();</span> i<span style="color: #333333;">++)</span> <span style="color: #333333;">{</span>
<span style="color: #008800; font-weight: bold;">for</span> <span style="color: #333333;">(</span><span style="color: #333399; font-weight: bold;">int</span> j<span style="color: #333333;">=</span>i<span style="color: #333333;">+</span><span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">;</span> j<span style="color: #333333;"><</span>number<span style="color: #333333;">.</span><span style="color: #0000cc;">length</span><span style="color: #333333;">();</span> j<span style="color: #333333;">++)</span> <span style="color: #333333;">{</span>
String temp <span style="color: #333333;">=</span> number<span style="color: #333333;">.</span><span style="color: #0000cc;">substring</span><span style="color: #333333;">(</span>i<span style="color: #333333;">,</span> j<span style="color: #333333;">);</span>
System<span style="color: #333333;">.</span><span style="color: #0000cc;">out</span><span style="color: #333333;">.</span><span style="color: #0000cc;">println</span><span style="color: #333333;">(</span>temp<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>temp<span style="color: #333333;">.</span><span style="color: #0000cc;">length</span> <span style="color: #333333;">></span> <span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
String simplify<span style="color: #333333;">;</span>
<span style="color: #333399; font-weight: bold;">int</span> product <span style="color: #333333;">=</span> getProduct<span style="color: #333333;">(</span>temp<span style="color: #333333;">);</span>
simplify <span style="color: #333333;">=</span> String<span style="color: #333333;">.</span><span style="color: #0000cc;">valueOf</span><span style="color: #333333;">(</span>product<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>numSet<span style="color: #333333;">.</span><span style="color: #0000cc;">contains</span><span style="color: #333333;">(</span>simplify<span style="color: #333333;">))</span> <span style="color: #333333;">{</span>
System<span style="color: #333333;">.</span><span style="color: #0000cc;">out</span><span style="color: #333333;">.</span><span style="color: #0000cc;">println</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"Not colorfull"</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #333333;">}</span>
numSet<span style="color: #333333;">.</span><span style="color: #0000cc;">add</span><span style="color: #333333;">(</span>temp<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #333333;">}</span>
System<span style="color: #333333;">.</span><span style="color: #0000cc;">out</span><span style="color: #333333;">.</span><span style="color: #0000cc;">println</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"colorfull"</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">int</span> <span style="color: #0066bb; font-weight: bold;">getProduct</span><span style="color: #333333;">(</span>String temp<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #333399; font-weight: bold;">int</span> product <span style="color: #333333;">=</span> <span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">;</span>
<span style="color: #008800; font-weight: bold;">for</span> <span style="color: #333333;">(</span><span style="color: #333399; font-weight: bold;">char</span> ch <span style="color: #333333;">:</span> temp<span style="color: #333333;">.</span><span style="color: #0000cc;">toCharArray</span><span style="color: #333333;">())</span> <span style="color: #333333;">{</span>
product <span style="color: #333333;">*=</span> <span style="color: #333333;">(</span><span style="color: #333399; font-weight: bold;">int</span><span style="color: #333333;">)</span>ch<span style="color: #333333;">;</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">return</span> product<span style="color: #333333;">;</span>
<span style="color: #333333;">}</span>
</pre></td></tr></tbody></table></div>
<p><br /></p>
<p>
<u><b>Round 3 Low Level Design</b></u>
</p>
<p>
Q1 Design a platform where<br />Write users : Uploading text based posts to
the platform<br />Read users : Giving a search query and retrieving the
results of posts. Limiting the result of posts to 100.<br />Not doing a feed
ranking. </p><p><a href="https://dausel.co/mVLxPF" target="_blank">Solution</a></p><p>Read users >> Write users (x50)
</p>
<p>
<b>Functional Requirements</b><br /></p><ul style="text-align: left;"><li>Limit to size of chars published - 200 chars</li><li>Publishing
the text</li><li>Retrieving the text</li></ul><p><br /><b>Non Functional</b><br /></p><ul style="text-align: left;"><li>Low latency
for retrieval</li></ul><p><br />Example<br /><PostId, PostContent><br />D1,
Furniture bed<br />D2, bed mattress<br />D3, mattress furniture<br /><br />Parameters
Attributing to relevancy of the post<br />Interface RankProvider {<br />}<br /><br />TimeBasedRankProvider<br /><br />CountBasedRankProvider<br /><br /><br />APIs<br /><br />PublishResponse
PostContent(PublishRequest);<br />PostResult FetchPost(String query)<br /><br />Request/Response
Model<br />PostResult {<br /> List<String> posts;<br />}<br /><br /><br />Service
Layer<br /><br /><br />The/a -> clear<br /><br />Inverted Index<br />Furniture
-> (D1,4,<time>), (D3, 6, <time>)<br /><br />Get top 100 out of
it<br /><br /><br />Translation Post API<br />Post will be associated with a
document id<br /><br />Delegated<br />Break all words from the post<br />Filter
works like a/the/quotes etc<br />Prepare a hashmap of Word to document id<br /><br />Map<String,
List<DocumentNode>> invertedPostMap;<br /><br />DocumentNode {<br />
Int docId<br /> Int count;<br /> int
publishedTimeEpoch;<br />}<br /><br />// Initialize this invertedMap on
startup<br />// Add to this inverted Map at realtime<br /><br /><br />Database
Choice - Nosql (consistent, replicate)<br /><Key Value store><br /><br />Cache
- Distributed cache like redis <br />Cache redis for a key<br /><br />Updating
redis via delegation flow<br /><br /><br />Operational Responsibility<br />Data
availability<br /><br />Front will have the load balancer <br />Cache might
fail - that will lead to increase in latency<br />DB Might be overloaded with
connections<br /><br />Logging - logfile route hourly/daily to a ES cluster
(visualization)<br />Metrics - publish metrics per min cloudwatch<br /><br />NumberOfPosts
Per Sec -> DDOS<br />DB Connection Metric - DB level<br /><br />TimeMetric
for Read Api -> total time for 1 read operation. Alarm on avg time per
min<br />10 ms read latency, alarm > 100 ms<br /><br />Alarms on Exceptions
- by cache/db over ES cluster<br /><br />Metrics around service usage ->
<br />How many reqs is you service handling daily?<br />
</p>
<p><br /></p>
<p>
<u><b>Round 4 High Level Design</b></u>
</p>
<p>
Q1 Design a Video Streaming Service like Youtube</p><p><a href="https://dausel.co/lJdjJ2" target="_blank">Solution1</a><br /><br /><b>Functional
Requirements</b><br /></p><ol style="text-align: left;"><li>Upload the video</li><li>Search/play the video (timeline)</li><li>Manage
the user</li><li>comments/ratings</li><li>Sharing the video over other platforms</li><li>Video
streaming in different qualities</li><li>likes/dislikes</li><li>Views for a video</li></ol><p><br /><b>Non
Functional Requirement</b><br /></p><ol style="text-align: left;"><li>High availability - service should be available
all the time</li><li>Reliability - the videos should not be lost</li><li>Read heavy
so low latency</li><li>We are ok with eventual consistency</li></ol><p><br /><br /><b>Scaling
Requirements</b><br />Uploads<br />1M uploads per month<br /><br />Search<br />5M
views per month<br />5M / 30*24*3600 views / sec<br /><br />User
Registration<br />1M users / month<br /><br />Growth - 5%<br /><br />Storage
Requirement<br />1 video storage (compressed/uncompressed)<br />Avg size per
video → 100 Mb<br />1M * 100 Mb = 100 Tb<br />Compression rate of 50% 50 Tb /
month<br /><br />600 Tb/ year<br /><br />Metadata storage -> 500 Kb /
video<br />500 kb * 1 M * 12 = 6 Tb / year<br /><br /><br />Metadata {<br />fileName<br />fileLocation<br />ThumbnailReference<br />}<br /><br />Thumbnails<br />Per
video we can have say 5 thumbnails.<br /><br /><br />Database/Storage
Requirement<br />User registration - we can go with a sql database<br /><br />Metadata
and thumbnails<br />Eventually consistent key value store such as dynamodb<br />It
will offer low latency for reads.<br /><br />Store for actual thumbnails -
s3<br /><br />Video store will be a big data storage<br /><br /><br />Database
Schema<br />How will the sharding be? <br /><br />Shard them based on hash of
a video id (these ids should be balanced/unique)<br />Writes will be balanced
across all the shards<br />Read might overload 1 shard if say a video is
viral. (use a cache layer to prevent this)<br /><br />User registration - Sql
database<br />Master - slave architecture<br />Challenge will be writes will
not be reflected instantly on slaves.<br />Updates/write will be very less
frequent.<br /><br />Comments<br />The aim is ordering should be
maintained.<br />If my database is eventually consistent, <br /><br />A user
entered a comment<br />my system takes the comment and sends success but
internally i will retry to make sure that it is stored with the right
timestamp.<br /><br /><br />2 replies happen at the same time<br />Both reply
are present in the queue<br />Once update succeeds the id is incremented<br />The
second reply will read the latest state, this latest state will have the new
id and thus my second reply will be stored.<br /><br /><br />Schema for
comments/replies<br /><br />Video-id → List<CommentId><br /><br />V1
→ [c1, c2, c3, c4]<br /><br />Hashkey - commentId<br />{<br />
commentId: string,<br /> Title: string,<br />
Description: string,<br /> lastUpdated: Timestamp,<br />
createdTime: Timestamp,<br /> replyIds:
<CommentIds>,<br /> updateId: integer (0)<br />}<br />
<br />Write: <VideoId, Comment><br /><br />2 concurrent writes for the
comment<br />C1 -> R1, R2<br /><br />Extract the comment json<br />R1 ->
replyIds(R1), updateId -> 1 - Accepted<br />R2 -> replyIds(R2), updateId
-> 0 - Rejected (part of a queue)<br /><br /><br />How do you serve the
video to users?<br />Service will be partitioned by region <br />A CDN
associated with every region - help me service the thumbnails of the video<br />Hot
store associated with internet gateways<br /><br /><br />Client ->
InternetGateway -> CDN -> LB -> Webserver -> LB -> AppServer
-> Cache -> Database<br /><br /><br />Video Deduplication<br />When-ever
a video uploads, the upload will happen in chunks<br />Every chunk can pass
through a de-dup process.<br /><br />After compression, 2 chunks can have same
properties. Return the reference of existing chunk<br /><br />Separate
service.<br /><br />Viewing it in different resolutions<br />Store in
different resolutions<br /><br /><br />Upload happens -> video is broken
into chunks -> pass chunk to a encoder to change the format<br /><br />Async
Backend flow to cast the video to different formats<br />Client -> [Queue -
chunk of the video] -> Q1, Q2, Q3, Q4 -> Appserver
</p>
<p><br /></p>
<p><b>Round 5 Hiring Manager Round</b></p>
<p>Q1 Give detailed description of your current project? <br /></p>
<p>Q2 Design a Coffee Vending Machine using OOPS. </p><p><a href="https://aaronice.gitbook.io/object-oriented-design/ood-case-studies/coffee-maker" target="_blank">Solution</a><br /></p>
<p>
Q3 Given unsorted 100 million integers = 10 crore, Java process JVM 500 MB RAM,
32 core CPU<br />// input : file having these all numbers<br />// output :
file sorted number<br /><br />1 million integers = 4MB</p><p><a href="https://dausel.co/ELmfgp" target="_blank">Solution</a><br />
</p>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-34576577262953559192021-04-03T18:19:00.009+05:302021-05-09T19:10:12.784+05:30System Design Interview Preparation<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Top System Design Guides</u></h2><div class="separator" style="clear: both; text-align: center;"><a href="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRbxBB2T4T4Zv9hB8y2nGjGctAxX_L_jZfp4A&usqp=CAU" style="margin-left: 1em; margin-right: 1em;"><img alt="System Design" border="0" data-original-height="101" data-original-width="499" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRbxBB2T4T4Zv9hB8y2nGjGctAxX_L_jZfp4A&usqp=CAU" title="System Design Interview" /></a></div><br />
<u><b>HLD</b></u><br />
<a href="https://al.ly/XUzUGY" target="_blank">InterviewBit Link</a><br />
<a href="https://al.ly/UR1tHT" target="_blank">Sample Case Study</a><br />
</div><div dir="ltr" style="text-align: left;" trbidi="on"></div><span><a name='more'></a></span><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on"></div><div dir="ltr" style="text-align: left;" trbidi="on"></div><div dir="ltr" style="text-align: left;" trbidi="on"></div><div dir="ltr" style="text-align: left;" trbidi="on"><br />
<u><b>Object Oriented Design</b></u><br />
<a href="https://al.ly/cUcqGB" target="_blank">Google Doc</a><br />
UML Design Patterns<br />
http://www.uml.org.cn/c++/pdf/DesignPatterns.pdf <br />
Youtube playlist <br />
<a href="https://www.youtube.com/watch?v=vNHpsC5ng_E&list=PLF206E906175C7E07" target="_blank">https://www.youtube.com/watch?v=vNHpsC5ng_E&list=PLF206E906175C7E07</a> <br />
<br />
<br />
<u><b>Cultural Fit </b></u><br />
Google Doc<br />
https://docs.google.com/document/d/1aSGvLKxoMWJM6XIAzrXlYpGdGP9bpPcpvwk2tGdvMBY/edit?usp=sharing</div><div dir="ltr" style="text-align: left;" trbidi="on"> </div><div dir="ltr" style="text-align: left;" trbidi="on"> </div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-56947038737126075502021-04-03T18:18:00.002+05:302021-05-09T19:10:33.566+05:30Amazon Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Amazon SDE II Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="415" data-original-width="739" height="177" src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" width="320" /></a></div>
Had 6 rounds<br />
1st Telephonic Screening<br />
4 Onsite Rounds<br />
1 Telephonic Bar raiser<br />
<a name='more'></a><br />
<br />
Below is my experience<br />
<b>Round1 - Telephonic</b><br />
Coding Question <br />
<br />
<b>Round2 - Coding/Problem Solving</b><br />
Q1 Given below currency conversions with their factors<br />
A - B 10<br />
B - C 8<br />
C - D 4<br />
Write a program such that given any pair of currency (C1, C2) with a total number of C1 we can convert C1 to C2 and return its final value.<br />
Optimize the program in a way that once all pairs are listed you need to convert the currency in constant time. <br />
<br />
<br />
<br />
<b>Round3 - HLD-LLD</b><br />deep dive<br />dealing with ambiguity<br /><br /><b>Round4 - Hiring Manager</b><br />
HM<br />leadership<br />ownership, earn trust, have backbone disagree & commit<br />
<br />
<br />
<br />
<br />
<br />
<b>Round 5 - System Design</b><br />biased for action<br /><br /><br /><br /><br /><b>Round 6 Bar Raiser</b><br />Coding, PS, 2<br />cust obbsession, deliver result<br /><br /><br /><b>Important Preparation/Focus Points</b><br />LLD - 3 layers (MVC)<br />
Focus on Extensibilty<br />In LLD provide abstraction, extensibility and configurability.<br /><br />HLD<br />
What kind of design are you expecting?<br />Validate assumptions<br />Requirements<br />
Gather functional requirements and also non functional requirements (HLD)<br />Provide acceptable/justification for choices made<br /><br /><br />Leadership principle<br />STAR<br />Where when why<br /><br />Cust obsession <br />insist on higher stanadard (14)<br /><br />earn trust<br />repeated questions (trust issue)</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-28435421930585925952020-08-22T13:48:00.002+05:302021-05-09T19:10:55.650+05:30Booking Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Booking.com Software Engineer Interview<br /></u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.asiamiles.com/content/dam/am-content/brand-v2/travel-pillar/logo-image/bookingcom/Booking.com_rgb_std_logo_1500.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Booking.com Software Engineer Interview" border="0" data-original-height="136" data-original-width="800" height="54" src="https://www.asiamiles.com/content/dam/am-content/brand-v2/travel-pillar/logo-image/bookingcom/Booking.com_rgb_std_logo_1500.png" title="Booking.com" width="320" /></a></div>
<br />
<b>Round1 - Hacker Rank Test</b><br />
Q1 Triangles<br />
Given 3 integers that represent edge lengths, identify if they could form a triangle or not.<br />
A triangle could be formed if sum of any two edges is greater than the length of the third edge.<br />
The output should be as below<br />
0 if No triangle could be formed or input is invalid<br />
1 if An equilateral triangle could be formed<br />
2 if A triangle that is not equilateral could be formed.<br />
<a name='more'></a><br />
<br />
Input: {3, 5, 4 }<br />
Output: 2 <br />
<br />
Q2 Delta Encoding<br />
Given a list of numbers as input<br />
<br />
Input<br />
25626<br />
25757<br />
24367<br />
24267<br />
16<br />
100<br />
2<br />
7277<br />
<br />
Output a delta encoding for the sequence where the first element is reproduced as-is and each subsequent element is represented as the numeric difference from the element before it.<br />
If the difference does not fit the single byte ie x between [-127 - 127] then instead of the difference print the escape token.<br />
<br />
Output<br />
25626<br />
-128<br />
131<br />
-128<br />
-1390<br />
-100<br />
-128<br />
-24251<br />
84<br />
-98<br />
<br />
Q3 Customer Service Capacity<br />
Gives the timestamps, find the minimum number of customer service executives needed to handle the calls.<br />
<br />
Q4 Sort hotel list<br />
Given a list of hotel identifiers and some number of reviews, sort the hotel identifiers based on the list of keyword of interest. The criteria of sort should be how many times a particular identifier is mentioned in any review.<br />
<br />
<br />
<b>Round2 - Hacker Rank Code Pair Round</b><br />
Q1 Rank the reviews of given hotel<br />
<br />
Q2 Design a search system in log file<br />
<br />
<b>Onsite Interview</b><br />
<b>Round3 - Technical Interview </b><br />
Write a optimized code for a Hit Counter<br />
<br />
<b>Round4 - Design Interview</b><br />
Design a payment system for Booking<br />
<br />
<b>Round5 - Manager Discussion</b></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-16324597105939671862020-08-22T13:47:00.004+05:302021-05-09T19:11:13.705+05:30Flipkart Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Flipkart SDE 2<br /></u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://s3.ap-southeast-1.amazonaws.com/cdn.deccanchronicle.com/sites/default/files/Flipkart_1_0_0.jpg" style="margin-left: 1em; margin-right: 1em;"><img alt="Flipkart Software Engineer Interview Experience" border="0" data-original-height="376" data-original-width="620" height="121" src="https://s3.ap-southeast-1.amazonaws.com/cdn.deccanchronicle.com/sites/default/files/Flipkart_1_0_0.jpg" title="Flipkart SDE 2" width="200" /></a></div>
Recently I got an opportunity to interview with Flipkart and below is my experience<br />
<br />
<b>Round1 Machine Coding</b><br />
We were given a set of requirements and the expectation was to come up with a working solution of those requirements. A simple Single threaded application was expected and a few set of test cases were already mentioned which your application should cover.<br />
The code should be extensible and working was the major requirement. <br />
The use of strategy pattern, observer patter comes handy here so make sure you learn them.<span><a name='more'></a></span><br />
<br />
<b>Round 2 Machine Coding Discussion</b><br />
Here they reviewed the code and extended the requirements to implements new features. I was asked to enhance and run it using the new enhanced version. Also discussed when the same code might run in multi threaded environment, how will you manage concurrency.<br />
<br />
<b>Round 3 System Design</b><br />
The System design question was to design a online multiplayer game of Ludo. I suggested the APIs and class level details of entities and how the game would function.<br />
<br />
<b>Round 4 Problem Solving and Data Structure</b><br />
Q1 Consider the sellers on a website where the customers offer them ratings and since this data is huge you need to suggest a way to identify the top K worst performing sellers so that they can be deleted from flipkart.<br />
<br />
Q2 Extended the question to what if K is very very close to N. How will you modify it to improve the time complexity.<br />
<br />
Q3 For the maven dependency tree, you need to print the order in which first which dependency need to finish compiling before other can be compiled.<br />
<br />
<b>Round 5 Hiring Manager</b><br />
Q1 Tell me about your self<br />
Q2 Why do you want leave your current company and join Flipkart?<br />
Q3 How do you handle full SDLC?<br />
Q4 Explain your current project and your role in it.<br />
Q5 What is the average response time of your APIs in production and 99th percentile <br />
Q6 If you are working on a requirement and say during the test phase you realised that a big requirement is missed? If the work required to handle this is another 1 month? How will you handle this?<br />
Q7 What are your weakness?</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-65009566831036112692019-09-27T22:17:00.005+05:302021-05-09T19:11:28.903+05:30Atlassian Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Atlassian Software Engineer Interview </u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8u_Yo0jcjtqcZBSug780J7yez7MdUnD_fIw9o1u281txLg2Ky" style="margin-left: 1em; margin-right: 1em;"><img alt="Atlassian Software Engineer Interview" border="0" data-original-height="420" data-original-width="420" height="200" src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8u_Yo0jcjtqcZBSug780J7yez7MdUnD_fIw9o1u281txLg2Ky" title="Atlassian Interview" width="200" /></a></div>
<br />
<u><b>Round1</b></u><br />
First round was a pair coding interview with one of their developers. I mentioned earlier that my preferred programming language for coding interview was Java. I was given a user management system project in Java. And screenshots of some Jira Issues which described some bugs in the project given to me.<br />
<br />
<a name='more'></a><br /><br />
Example Questions<br />
Q1 Removing user from an already empty group will simply be ignored. Write a test case to verify the same.<br />
<br />
Q2 A new group is created using Group class but when queried there are already users in the group.<br />
<br />
Q3 A user is not coming as part of the group when added successfully to the group<br />
<br />
Q4 Implement the support for nested groups. Try to learn about flatMap in java<br />
<br />
Q5 Modify the application to make it thread safe. You may refactor the code or change its data structure as needed. Either describe or write how would you test your implementation.<br />
<br />
<br />
<u><b>Round2</b></u><br />
Divided into 3 parts<br />
1. Projects you have worked on with a detailed explanation of one of the project<br />
2. Technical Questions spanning Java Internal memory, how garbage collections works, major minor GC, REST API design best practices<br />
3. Extend the implementation of their ConnectionPool<br />
<a href="https://al.ly/Tc7WMU" target="_blank">Solution </a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-744834350337798332019-09-15T13:09:00.004+05:302021-05-09T19:11:43.443+05:30Ola Electric Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Ola Electric Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://res-3.cloudinary.com/crunchbase-production/image/upload/c_lpad,h_256,w_256,f_auto,q_auto:eco/egy2ousjavdthg7t9gy3" style="margin-left: 1em; margin-right: 1em;"><img alt="Ola Electric Software Engineer Interview" border="0" data-original-height="256" data-original-width="256" src="https://res-3.cloudinary.com/crunchbase-production/image/upload/c_lpad,h_256,w_256,f_auto,q_auto:eco/egy2ousjavdthg7t9gy3" title="Ola Electric" /></a></div>
<b>Round 1</b><br />
Q1 Print a matrix in zig zag fashion?<br />
<a href="https://dausel.co/adqaGM" target="_blank">Solution</a><br />
<br />
<a name='more'></a><br />
<br />
<b>Round 2</b><br />
Q1 Discussion on different authentication mechanisms? Bearer, oAuth, JWT<br />
<br />
Q2 Difference between authentication and authorization<br />
<br />
Q3 Given array { 1 2 3 4 5 6 7 8 9 10 } print { 2 3 7 8 9 10 }<br />
Skip 1, print next 2, skip next 3, print next 4<br />
<br />
Q4 Stream of numbers are coming and a camera is recording them but the output from camera is rotated by 180 degree. How many numbers are same as 180 degree
rotation of the original number. Write program to print those numbers? You need to identify all the possible test cases before writing the code.<br />
<br />
0, 1, 6, 8 and 9 are same as 180 degree rotation.<br />
Ex 69, 689, 121, 11 <br />
<br />
<br />
<b>Round 3</b><br />
Q1 Spring Bean life cycle<br />
<br />
Q2 What is a java bean?<br />
JavaBeans are classes that encapsulate many objects into a single object (the bean). It is a java class that should follow following conventions:<br />
Must implement Serializable.<br />
It should have a public no-arg constructor.<br />
All properties in java bean must be private with public getters and setter methods.<br />
<br />
Q3 What is IOC, Dependency Injection<br />
<br />
Q4 How Autowired works in Spring<br />
<br />
Q5 Difference between Component, Service and Repository<br />
<br />
Q6 How will you handle horizontal partitioning in mysql database?<br />
<br />
Q7 System design of Twitter <br />
<br />
<br />
<b>Round 4</b><br />
Q1 System design of uber payments.<br />
<br />
Q2 Given an n*m matrix. Write a program to print the min path from source to destination such that you can move only right and down and if there are 'X' in the path then you cannot cross that path.<br />
[S ]<br />
[ X X ]<br />
[ X ]<br />
[ D]<br />
<br />
<a href="https://dausel.co/HFVYJc" target="_blank">Solution</a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-48849590634126221262019-09-15T12:44:00.005+05:302021-05-09T19:11:57.185+05:30Circles Life Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Circles Life Singapore Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Circles.Life_Logo.png/220px-Circles.Life_Logo.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Circles Life Singapore" border="0" data-original-height="262" data-original-width="220" height="200" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Circles.Life_Logo.png/220px-Circles.Life_Logo.png" title="Circles Life Singapore Interview" width="168" /></a></div><br />
<br />
<u><b>Round1 - Online Coding Assessment</b></u><br />
<b>Q1 Employees Per Department</b><br />
A company uses 2 data tables, Employee and Department, to store data about its employees and departments. <br />
<a name='more'></a><br />
Table Name: Employee<br />
Attributes: <br />
ID Integer,<br />
NAME String,<br />
SALARY Integer,<br />
DEPT_ID Integer<br />
<br />
Table Name: Department<br />
Attributes:<br />
DEPT_ID Integer,<br />
Name String,<br />
LOCATION String<br />
<br />
Write a query to print the respective Department Name and number of employees for all departments in the Department table (even unstaffed ones). <br />
<br />
Sort your result in descending order of employees per department; if two or more departments have the same number of employees, then sort those departments alphabetically by Department Name.<br />
<br />
<a href="https://dausel.co/hPLUp7" target="_blank">Solution</a><br />
<br />
<b>Q2 Maximum Difference in an Array</b><br />
Given an array arr[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number.<br />
In other words, for the array arr, find the maximum value of arr[j] - arr[i] such that 0<=i<j and="" arr="" i="" j="" n="" p="">If no item has a smaller item with a lower index then return -1<br />
<br />
Sample Case<br />
Input<br />
7<br />
2 3 10 2 4 8 1<br />
<br />
Output: 8<br />
Explanation<br />
3 - [2] = 1<br />
10 - [3, 2] = [7, 8]<br />
4 - [2, 3, 2] = [2, 1, 2]<br />
8 - [4, 2, 3, 2] = [4, 6, 5, 6]<br />
<br />
Thus the maximum is found at 10-2 = 8<br />
<br />
<a href="https://dausel.co/qkLhXZ" target="_blank">Solution</a><br />
<br />
<b>Q3 Steps to convert binary number to zero</b><br />
Given a decimal number, how many minimum possible steps are required to convert this to zero provided:<br />
</j><br />
<ul style="text-align: left;">
<li>Change the bit i if the next bit i+1 is '1' and rest all the other bits i+2 and later is 0</li>
<li>Change the last bit without restriction</li>
</ul>
<a href="https://dausel.co/u7m8OV" target="_blank">Solution </a><br />
<br />
<br />
<u><b>Round2 - Coding and Problem Solving</b></u><br />
Q1 Print all the maximum elements from the right?<br />
Example<br />
Input: { 10, 4, 6, 3, 5 }<br />
Output: { 10, 6, 5 }<br />
<br />
<a href="https://dausel.co/pdpkU6" target="_blank">Solution</a><br />
<br />
Q2 Print all the zero sum triplet in a given array.<br />
Example<br />
Input: {4, 0, -1, -3, -9, -4, 2 , 1}<br />
Output: [[a = -4, b = 0, c = 4], [a = -3, b = -1, c = 4], [a = -1, b = 0, c = 1]]<br />
<br />
<a href="https://dausel.co/fNcDTv" target="_blank">Solution</a><br />
<br />
Q3 Print first non recurring character in a given array.<br />
Example<br />
Input: {'d', 'g', 'h', 'w', 'i', 'g', 'd', 'w', 'o'}<br />
Output: h<br />
<br />
<a href="https://dausel.co/ejvwWG" target="_blank">Solution</a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-27857255494476046912019-07-28T15:57:00.004+05:302021-05-09T19:12:18.625+05:30Goldman Sachs Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Goldman Sachs Software Developer Hiring Test</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/Goldman_Sachs.svg/1200px-Goldman_Sachs.svg.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Goldman Sachs Software Developer" border="0" data-original-height="800" data-original-width="800" height="200" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/Goldman_Sachs.svg/1200px-Goldman_Sachs.svg.png" title="Goldman Sachs" width="200" /></a></div>
<br />
<b>Q1 Number Checker</b><br />
Given an integer array as input, find out the integers which contains the digit 1, 2, 3. The order need not be sequential.<br />
<ul style="text-align: left;">
<li>In case multiple numbers qualifies the condition, the outcome should be ordered based on numeric value in ascending order separated by comma</li>
<li>In case no number qualifies the condition, return -1.<a name='more'></a></li>
</ul>
Example<br />
Input<br />
1456<br />
345671<br />
43218<br />
123<br />
<br />
Output 123, 43218<br />
<a href="https://dausel.co/itEYN0" target="_blank">Solution</a> <br />
<br />
<b>Q2 Array Burst Problem</b><br />
Given an input length, string array and burst length (>0), the output should be an array such that the sequentially repeating elements more than or equal to the burst length should be removed. This has to be repeated till the array cannot be shrunk any further.<br />
<br />
Sample1<br />
Input<br />
8<br />
a b c c c d e e<br />
3<br />
<br />
Output: a b d e e<br />
<br />
Sample2<br />
Input<br />
15<br />
a b c d e e e e d d c b f g f<br />
3<br />
<br />
Output: a b c c b f g f<br />
<a href="https://dausel.co/itEYN0" target="_blank">Solution</a> <br />
<br />
<b>Q3 Non repeating digit in product</b><br />
Given a number x, and a range of y to z, find the count of all the numbers n in that range such that the product of the number n and x does not contain any digit from the number n.<br />
Example<br />
x=2, y=10, x=15 then<br />
2*10=20 Invaid<br />
2*11=22 Valid<br />
2*12=24 Invalid<br />
2*13=26 Valid<br />
2*14=28 Valid<br />
2*15=30 Valid<br />
<br />
Output: 4<br />
<a href="https://dausel.co/mNTOyf" target="_blank">Solution</a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-55160852281994269622019-02-16T22:49:00.004+05:302021-05-09T19:12:36.907+05:30Salesforce Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<u>Salesforce Interview Experience - Security Team</u></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.businessnewsdaily.com/images/i/000/015/216/original/salesforce.png?1519246328" style="margin-left: 1em; margin-right: 1em;"><img alt="Salesforce Interview Experience" border="0" data-original-height="400" data-original-width="600" height="213" src="https://www.businessnewsdaily.com/images/i/000/015/216/original/salesforce.png?1519246328" title="Salesforce Interview Experience" width="320" /></a></div>
Got a chance to interview with the salesforce security team.<br />
<a name='more'></a><br />
Below are some questions discussed<br />
<br />
1. Authentication vs Authorization<br />2. Factorial of a large number - <a href="http://ally.sh/Wtg6K" target="_blank">Solution</a><br />3. Inheritance model in Javascript<br />4. How to secure a rest API - various methods<br />5. HTTP verbs you have worked with - difference between Patch and Put<br />6. How have you used certificates? </div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-55218567787113515422019-02-16T22:40:00.007+05:302021-05-09T19:51:10.839+05:30Paytm Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Paytm Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRNhzRygeHRUgQ20BhBx-rXn-g3KBAPXI0YQ1ExajP7XKAQzQX_l07W_6TWRfYiqDGjeG822IKup8foer3XaGGS9jYTWr4vq24HYIMTx_0S3GSXB7PjJ2FlX2HFL56AL1DPSJ1zyIj47I/s1600/Paytm-One97-Jobs.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Paytm Interview Experience" border="0" data-original-height="218" data-original-width="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRNhzRygeHRUgQ20BhBx-rXn-g3KBAPXI0YQ1ExajP7XKAQzQX_l07W_6TWRfYiqDGjeG822IKup8foer3XaGGS9jYTWr4vq24HYIMTx_0S3GSXB7PjJ2FlX2HFL56AL1DPSJ1zyIj47I/s16000/Paytm-One97-Jobs.png" title="Paytm Interview Experience" /></a></div>
<b>Coding Round 1</b><br />
Q1 You have to make a necklace with pearls. Minimum number of pearls that can be used is 1 and maximum is n. Each pearl has a magnificence coefficient and the necklace should be such that the pearls are in ascending order of their magnificence. Find such number of necklaces that can be formed with given condition.<br />
Input given is n (no of pearls), Lowest magnificence and highest magnificence.<br />
Example n= 1, LM= 8 HM=9, so there can be 2 cases, one necklace with pearl 8 and one with pearl 9.<br />
<br />
Q2 Write a program to find sum of first largest k elements from a given array of integers?<br />
<a name='more'></a><br />
<br />
<b>Interview Round 1</b><br />
Q1 Write a program to print the left view and right view of a tree in single traversal and o(n) time complexity<br />
<br />
Q2 Difference between Composition and Inheritance with example? Which is better?<br />
<br />
Q3 What is Immutable? Example<br />
<br />
Q4 What is strategy pattern? Its real life example<br />
<br />
Q5 What is Singleton. Implement one. How will your singleton handle multi-threading and Serialization issues.<br />
<br />
Q6 Design Patterns you have used in your project? Write builder pattern and why we use builder pattern with example<br />
<br />
Q7 Collections.sort internally uses which sorting algorithm. - It uses stable, adaptive merge sort.<br />
Note: Arrays.sort for primitives uses dual pivot Quick Sort.<br />
<br />
Q8 In Spring what is IOC (Inversion of Control) and DI (Dependency Injection).<br />
<br />
Q9 Difference between EJB and Spring framework. What Spring offers better than EJB<br />
<br />
Q10 Difference between JPA and Hibernate? How are they related or differ.<br />
<br />
Q11 What is tomcat - web server or app server? Difference between web server, container and app server?<br />
<br />
Q12 What is @Transactional in hibernate?<br />
<br />
Q13 What is proxy? Have you used it?<br />
<br />
Q14 Design Question - Design autocomplete in google search?<br />
Features, Data Structure, latency and Scalability related questions.<br />
<br />
Q15 What is docker? How docker stores its images?<br />
<br />
Q16 How database storage works? What is Indexing? How indexing happens in databases and how it improves the search in a database. Brief discussion on BTrees and B+Trees.<br />
<br />
<br />
<b>Interview Round 2</b><br />
Q1 Identify various components of a bank? Design schema for bill payment component? Brief discussion on normalization and how to make search faster in the database.<br />
<br />
Q2 Write a Spring controller to get customer details by id<br />
<br />
Q3 Implement concurrent hashmap. Follow up questions on the same like why no read lock on get method, how many threads will be able to access at once, synchronization issues etc.<br />
<br />
<b><br /></b>
<b>Interview Round 3</b><br />
Q1 Identify various micro-services of uber like application.</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-22974515056991146542019-02-16T22:40:00.002+05:302019-02-16T22:40:12.781+05:30Microsoft IDC Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Microsoft IDC Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://smedia2.intoday.in/btmt/images/stories/microsoft-660_042518074140.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="450" data-original-width="660" height="218" src="https://smedia2.intoday.in/btmt/images/stories/microsoft-660_042518074140.jpg" width="320" /></a></div>
<br />
Round1<br />
Q1 Write a program for maximum sum contiguous subarray.<br />
Q2 Below string is encoded in a matrix in below fashion. Logic to decode the string<br />
<a name='more'></a><br />
<br />
Round2<br />
Q1 Beladys anomaly<br />
Q2 Given a multi level linked list, merge it in a sorted fashion<br />
Q3 What design patters have you worked on. What is a visitor design pattern. Others asked were Observer and builder.<br />
Q4 You are given a cube of side 5 which is painted red on all sides. You cut the cube in 1 unit pieces. How many pieces will be there with no sides painted.<br />
<br />
Round3<br />
Q1 Write a swap function in Java to swap 2 integers.<br />
Q2 Find the second maximum BST </div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-26686651553642855222018-08-26T12:16:00.000+05:302018-08-26T12:16:52.414+05:30Broctagon Fintech Software Engineer Challenge<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Broctagon Fintech Software Engineer Challenge</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cdn-images-1.medium.com/max/1024/1*HddKPwMW0OuWn9nh9LE9XA.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="195" data-original-width="800" height="78" src="https://cdn-images-1.medium.com/max/1024/1*HddKPwMW0OuWn9nh9LE9XA.png" width="320" /></a></div>
<br />
<u><b>Red and Blue Rangers</b></u><br />
Red and Blue Rangers are sent for a fight. Each ranger has a power where it can only kill the villans who have powers in their range.<br />
<br />
More precisely, Red ranger is given a range of 1 to A, both inclusive and Blue ranger is given a range of B to C both inclusive. To make sure that villans don't predict this range, following constraints hold-<br />
1 <= B <= C<br />
B <= A <= C<br />
<a name='more'></a><br />
<br />
and if a ranger fights a villan with power x, only he should fight all the villans who have power x ie if Red ranger decides to fight a villan with power 2 then he has to fight with all the villans who have power 2.<br />
<br />
Each ranger fights one at a time. It takes 1 min to kill a villan and 2 mins to switch places.<br />
Ranger would like to kill all villans as fast as possible. Find the minimum time that is needed to kill all the villans.<br />
<br />
Input<br />
3 2 2<br />
6<br />
1 2 3 2 1 2<br />
<br />
Output<br />
10<br />
<br />
Red ranger can kill villans with power 1 and 2<br />
Blue ranger can kill villans with power 2 and 3<br />
<br />
<br />
<br />
<u><b>Garry and points</b></u><br />
A coder I is better than coder J if and only if both of coder I's points are greater than or equal to J's corresponding points, with atleast one being greater. For each coder I, determine how many coders coder I is better than.<br />
For every input file, you need to determine the number of lines present to find number of participants. <br />
<br />
Input<br />
1798 1832<br />
862 700<br />
1075 1089<br />
<br />
Output<br />
2<br />
0<br />
1<br />
<br />
Explaination<br />
There are 3 players. Player 1 is better than 2 and 3, Player 2 is not better than anyone, player 3 is better than player 2<br />
<br />
Input<br />
1656 1649<br />
1014 1473<br />
<br />
Output <br />
1<br />
0 </div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-28423565276458483412018-08-25T09:47:00.002+05:302021-05-09T19:51:21.453+05:30Expedia Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Expedia Software Dev Engineer</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://ukcontact.center/wp-content/uploads/2018/03/expedia-logo-1132x509.jpg" style="margin-left: 1em; margin-right: 1em;"><img alt="Expedia Software Dev Engineer" border="0" data-original-height="360" data-original-width="800" height="143" src="https://ukcontact.center/wp-content/uploads/2018/03/expedia-logo-1132x509.jpg" title="Expedia Software Dev Engineer" width="320" /></a></div>
Round 1 - Coding<br />
Q1 Write a program to reverse a linked list? Change it to reverse linked list in size of n. (only approach was asked) - <a href="http://ally.sh/lVbxR" target="_blank">Solution</a><br />
<br />
Q2 You are getting a stream of infinite data, write a program extract the min 8 values based on priority from that stream? - <a href="http://ally.sh/I8uot" target="_blank">Solution</a><br />
<a name='more'></a><br />
<br />
Q3 What is immutable in Java? Explain - <a href="http://ally.sh/Immutable" target="_blank">Solution</a><br />
<br />
Q4 Write a program to convert a binary tree into a doubly linked list. - <a href="http://ally.sh/idp0x" target="_blank">Solution</a><br />
<br />
Q5 Write a program to get the minimum value from stack at any given time. - <a href="http://ally.sh/J53Ie" target="_blank">Solution</a><br />
<br />
<br />
Round 2 - Coding<br />
Q1 Explain your project.<br />
<br />
Q2 Dutch National Flag problem. - <a href="http://ally.sh/tPW2q" target="_blank">Solution</a><br />
<br />
Q3 Write a program to convert a binary tree into doubly linked list in place. Different approaches discussed.<br />
<br />
<br />
Round 3 - Coding and Design<br />
Q1 Explain your project.<br />
<br />
Q2 Given a set of integers, write a program to form a rectangle of max area such that distance between ever adjacent integer is 1.<br />
<br />
Q3 Design a service for Expedia that allows you to store and mark your search as favourite and later show markes searchs first and then the other searches.<br />
Everything from web server design to database to load was discussed.<br />
<br />
Round 4 - Manager<br />
Q1 General behavioural questions<br />
<br />
Q2 Rat poison puzzle.<br />
<br />
Q3 Why Expedia/ what new do you bring to expedia/ why should we hire you? </div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-10482938227126399982018-08-24T22:48:00.001+05:302018-08-24T22:48:33.022+05:30JP Morgan Written Test<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>JP Morgan Java & SQL Online Screening</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<span id="goog_184504982"></span><span id="goog_184504983"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://s20967.pcdn.co/wp-content/uploads/2017/06/Screen-Shot-2017-06-28-at-10.35.01-AM-768x436.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="436" data-original-width="768" height="181" src="https://s20967.pcdn.co/wp-content/uploads/2017/06/Screen-Shot-2017-06-28-at-10.35.01-AM-768x436.png" width="320" /></a></div>
Q1 Suppose there is a class called Employee. Is it possible to create a Map as shown below?<br />
<div style="background: #202020; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #d0d0d0;">Map<Employee,</span> <span style="color: #d0d0d0;">String></span> <span style="color: #d0d0d0;">map</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">HashMap<Employee,</span> <span style="color: #d0d0d0;">String>();</span>
</pre>
</div>
<br />
if yes, what minimum change will you make to the Employee class (Pre - java 8)<br />
<br />
A. It is not possible to create a map this way<br />
B. Override equals method<br />
C. Override hashcode method<br />
D. Override compareTo method<br />
<b>E. Override equals and hashCode method</b><br />
<a name='more'></a><br />
<br />
Q2 Suppose there is a class called Employee. Is it possible to create a Map as shown below?<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #d0d0d0;">Map<Employee,</span> <span style="color: #d0d0d0;">String></span> <span style="color: #d0d0d0;">map</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">TreeMap<Employee,</span> <span style="color: #d0d0d0;">String>();</span>
</pre>
</div>
<br />
if yes, what minimum change will you make to the Employee class<br />
<br />
A. It is not possible to create a map this way<br />
B. Override equals method<br />
C. Override hashcode method<br />
<b>D. Override compareTo method</b><br />
E. Override equals and hashCode method<br />
<br />
Q3 Given the following piece of code, which of the following options will never be printed by this program<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">class</span> <span style="color: #447fcf; text-decoration: underline;">SynchronizedTest</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #6ab825; font-weight: bold;">private</span> <span style="color: #d0d0d0;">String</span> <span style="color: #d0d0d0;">name;</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #447fcf;">SynchronizedTest</span><span style="color: #d0d0d0;">(String</span> <span style="color: #d0d0d0;">name)</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #6ab825; font-weight: bold;">this</span><span style="color: #d0d0d0;">.</span><span style="color: #bbbbbb;">name</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">name;</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">static</span> <span style="color: #6ab825; font-weight: bold;">synchronized</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">staticSynchMethod</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #d0d0d0;">System.</span><span style="color: #bbbbbb;">out</span><span style="color: #d0d0d0;">.</span><span style="color: #bbbbbb;">print</span><span style="color: #d0d0d0;">(</span><span style="color: #ed9d13;">"SM1 "</span><span style="color: #d0d0d0;">);</span>
<span style="color: #d0d0d0;">System.</span><span style="color: #bbbbbb;">out</span><span style="color: #d0d0d0;">.</span><span style="color: #bbbbbb;">print</span><span style="color: #d0d0d0;">(</span><span style="color: #ed9d13;">"SM2 "</span><span style="color: #d0d0d0;">);</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">synchronized</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">synchMethod</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #d0d0d0;">System.</span><span style="color: #bbbbbb;">out</span><span style="color: #d0d0d0;">.</span><span style="color: #bbbbbb;">print</span><span style="color: #d0d0d0;">(name</span> <span style="color: #d0d0d0;">+</span> <span style="color: #ed9d13;">"M1 "</span><span style="color: #d0d0d0;">);</span>
<span style="color: #d0d0d0;">System.</span><span style="color: #bbbbbb;">out</span><span style="color: #d0d0d0;">.</span><span style="color: #bbbbbb;">print</span><span style="color: #d0d0d0;">(name</span> <span style="color: #d0d0d0;">+</span> <span style="color: #ed9d13;">"M2 "</span><span style="color: #d0d0d0;">);</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">static</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">main</span><span style="color: #d0d0d0;">(String[]</span> <span style="color: #d0d0d0;">args)</span> <span style="color: #6ab825; font-weight: bold;">throws</span> <span style="color: #d0d0d0;">InterruptedException</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #6ab825; font-weight: bold;">final</span> <span style="color: #d0d0d0;">SynchronizedTest</span> <span style="color: #d0d0d0;">o1</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">SynchronizedTest(</span><span style="color: #ed9d13;">"o1"</span><span style="color: #d0d0d0;">);</span>
<span style="color: #d0d0d0;">Thread</span> <span style="color: #d0d0d0;">t1</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">Thread()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: orange;">@Override</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">run</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #d0d0d0;">o1.</span><span style="color: #bbbbbb;">synchMethod</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">};</span>
<span style="color: #d0d0d0;">Thread</span> <span style="color: #d0d0d0;">t2</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">Thread()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: orange;">@Override</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">run</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #d0d0d0;">staticSynchMethod();</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">};</span>
<span style="color: #d0d0d0;">Thread</span> <span style="color: #d0d0d0;">t3</span> <span style="color: #d0d0d0;">=</span> <span style="color: #6ab825; font-weight: bold;">new</span> <span style="color: #d0d0d0;">Thread()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: orange;">@Override</span>
<span style="color: #6ab825; font-weight: bold;">public</span> <span style="color: #6ab825; font-weight: bold;">void</span> <span style="color: #447fcf;">run</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
<span style="color: #d0d0d0;">staticSynchMethod();</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">};</span>
<span style="color: #d0d0d0;">t1.</span><span style="color: #bbbbbb;">start</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">t2.</span><span style="color: #bbbbbb;">start</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">t3.</span><span style="color: #bbbbbb;">start</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">t1.</span><span style="color: #bbbbbb;">join</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">t2.</span><span style="color: #bbbbbb;">join</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">t3.</span><span style="color: #bbbbbb;">join</span><span style="color: #d0d0d0;">();</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span>
</pre>
</div>
<br />
A. O1M1 O1M2 SM1 SM2 SM1 SM2<br />
<b>B. O1M1 SM1 SM2 O1M2 SM1 SM2</b><br />
C. SM1 SM2 O1M1 O1M2 SM1 SM2<br />
D. SM1 SM1 SM2 SM2 O1M1 O1M2<br />
E. SM1 O1M1 SM2 O1M2 SM1 SM2<br />
<br />
Q4 Which of the class given below relies upon its subclasses for complete implementation of its methods?<br />
A. Object class<br />
<b>B. abstract class</b><br />
C. Class class<br />
D. None of these<br />
<br />
Q5 In Java, the methods declared as ____________ cannot be overridden.<br />
A. public, static or abstract<br />
B. public or final<br />
<b>C. private, static or final</b><br />
D. abstract or final<br />
<br />
Q6 How many join conditions are required to join 4 tables in SQL?<br />
A. 1<br />
B. 2<br />
<b>C. 3</b><br />
D. 4<br />
<br />
Q7 Which of the following commands is used to remove an index from the database in SQL?<br />
A. Delete Index<br />
<b>B. Drop Index</b><br />
C. Remove Index<br />
D. Roll back index<br />
<br />
Q8 Which of these is not a type of SQL constraint?<br />
A. Primary Key<br />
B. Foreign Key<br />
<b>C. Alternate Key</b><br />
D. Unique<br />
<br />
Q9 In SQL, which of the following statements is used to end the current transaction and make permanent changes in the transaction.<br />
A. ZIP<br />
B. PACK<br />
<b>C. COMMIT</b><br />
D. SAVE<br />
<br />
Q10 Consider below table Employee<br />
Field<br />
id - int<br />
name - text<br />
manager_id - int<br />
<br />
Write a SQL query to list all employee names along with their manager names, output should include employee without any manager as well.<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">select</span> <span style="color: #d0d0d0;">a.name,</span> <span style="color: #d0d0d0;">b.name</span> <span style="color: #6ab825; font-weight: bold;">from</span> <span style="color: #d0d0d0;">Employee</span> <span style="color: #d0d0d0;">a</span> <span style="color: #6ab825; font-weight: bold;">left</span> <span style="color: #6ab825; font-weight: bold;">join</span> <span style="color: #d0d0d0;">Employee</span> <span style="color: #d0d0d0;">b</span> <span style="color: #6ab825; font-weight: bold;">where</span> <span style="color: #d0d0d0;">a.manager_id</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">b.id;</span>
</pre>
</div>
<br />
<br />
Q11 For above table, Write a SQL query to list all manager ids and names who have more than 1 report.<br />
<br />
<br />
Q12 Given weights of a log from left end upto distance x upto length l. Write a function that returns the balance point from the left.</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-70469891064653214332018-08-18T00:32:00.003+05:302021-05-09T19:12:52.281+05:30Intellij IDEA Ultimate Download<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Intellij IDEA Ultimate 2018.1.5 Ultimate</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://hownot2code.files.wordpress.com/2019/01/intellij-519-d4ff21c469.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="140" data-original-width="519" src="https://hownot2code.files.wordpress.com/2019/01/intellij-519-d4ff21c469.png" /></a></div><br />
<u><b>About</b></u> <br />
IntelliJ IDEA 2018 Activation Key supports to create web-based applications.It has the modern technologies and frameworks. IntelliJ IDEA is an IDE for Java, it also understands and gives intelligent coding assistance for a large variety of other languages such as SQL, JPQL, HTML, JavaScript, etc.It is a reliable and useful solution value having if you want to build up mobile and web systems using intuitive editors for various development languages such as for example LESS, TypeScript or CoffeeScript.<br />
<a name='more'></a><br />
<br />
<b>Key Features Of IntelliJ IDEA 2018</b>:<br />
<ol style="text-align: left;">
<li>Detecting duplicates</li>
<li>Inspections and quick-fixes</li>
<li>The IDE comes with a built-in terminal.</li>
<li>IntelliJ IDEA License Server comes with a built-in decompiler for Java classes.</li>
<li>It offers an unbeatable toolset right from the first start: decompiler, bytecode viewer, FTP and many more.</li>
<li>When you debug your code IntelliJ IDEA shows you variable values right in the source code, next to their usages. </li>
</ol>
<br />
Download Here for<br />
<a href="http://ally.sh/Wpg6n" target="_blank">Ubuntu</a><br />
Windows<br />
<a href="https://dausel.co/GS85At" target="_blank">Mac</a><br />
<br />
<a href="http://ally.sh/Vsfno" target="_blank">Click for Password</a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-37878800747633635492018-08-17T23:23:00.001+05:302018-08-25T09:47:50.166+05:30Adobe Software Engineer Aptitide Test Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cdn-images-1.medium.com/max/1600/1*6CcjiM0Cc7cfqoqAkFz6uA.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="198" data-original-width="660" height="96" src="https://cdn-images-1.medium.com/max/1600/1*6CcjiM0Cc7cfqoqAkFz6uA.png" width="320" /></a></div>
<br />
Q1 1.In a group of people solicited by a charity, 30% contributed $40 each, 45% contributed $10 each and the rest contributed $12 each. What is the percentage of the total contributed came from the people who gave $40?<br />
<br />
a)25% b)30% c)40% d)45% <b>e)50%</b><br />
<br />
2.ABCD is a rectangle. The length of BE is 4 and the length of EC is 6. The area of the triangle BEA plus the area of the triangle DCE minus the area of the triangle AFO is.(Answer was zero)<br />
<br />
a) 0 b) 0.4 of the area of the triangle AEB c)0.5 of the area of the triangle AED d)0.5 of the area of ABCD<br />
e)cannot be determined<br />
<a name='more'></a><br />
<br />
3. 36 identical chairs must be arranged in rows with the same number of chairs in each row. Each row must contain at least three chairs and there must be at least three rows. The row is parallel to the front of the room. How many different arrangements are possible? Pick one of the choices<br />
<br />
a) 2 b) 4 <b>c) 5</b> d)6 e) 10<br />
<br />
<br />
4.A pension fund has a total of $1 million invested in stock of the ABC company and the bonds of the DEE Corporation. The ABC stocks yields 12% in cash each year, and the DEE bonds pay 10% in cash each year. The pension fund received a total of $115,000 in cash from ABC stock and the DEE bonds last year. How much money was invested in ABC stock?<br />
<b>a)$750,000</b> b)$600,000 c)$500,000 d)$333,333.33 e)$250,000<br />
<br />
Q5 A cylinder of radius 5 mm<br />
and height 11 mm<br />
(volume of a cylinder is pie-r2h)<br />
<br />
A sphere of radius 6mm<br />
(volume of a sphere is 4/3 pie r3)<br />
<br />
A cube with edge 9mm<br />
(volume of a cube is e3)<br />
<br />
Which of the following solids has the largest volume? (figures are not drawn to scale)<br />
Pickone of the choices<br />
I<br />
II<br />
III<br />
I &II<br />
ii & iii<br />
<br />
<br />
6.The ratio of the chickens to pigs to horses on a farm can be expressed as the triple ratIo 20:4:6 If there are 120 chickens on the farm, then the number of horses on the farm Is :<br />
a)4 b)6 c)24 <b>d)36</b> e)60<br />
<br />
7.It x2 — y2 =15, and x + y =3 then x — y is :<br />
-3 0 3 <b>5</b> Cannot be determined<br />
<br />
8.two white O O inside big black O What is the area of the shaded region? The radius of the outer circle is a and the radius of each of the circles inside the larger circle is a/3 :<br />
(1/3)na2 (2/3)na2 <b>(7/9)na2</b> (8/9)na2<br />
<br />
9. Information Column A Column B<br />
compare-> 197+398+586 203+405+607<br />
<br />
Pick one of the choices<br />
Column A is greater<br />
<b>Column B is greater</b><br />
Column A and B are equal<br />
Relationship cannot be determined from the information given<br />
<br />
<br />
10. The operation * applied to a number gives as its result 10 subtracted from twice the number. What is * (*9)?<br />
Pick one of the choices<br />
<br />
<b>6</b><br />
8<br />
9<br />
36<br />
<br />
11. Information Column A Column B<br />
x>o x^2 10/x<br />
<br />
Pick one of the choices<br />
Column A is greater<br />
<b>Column B is greater</b><br />
Column A and B are equal<br />
Relationship cannot be determined from the information given<br />
<br />
12 If x/y = 3/z then 9y2 equals<br />
Pick one of the choices<br />
x2/9<br />
x3z<br />
<b>x2z2</b><br />
3x2<br />
(1/9)x2z2<br />
<br />
13. A car travels 75% of the way from town A to town B by travelling for T hours at an average speed of V mph.<br />
The car travels at an average speed of S mph for the remaining part of the trip. Which of the following<br />
expressions represents the time the car travelled at S mph?<br />
Pick one of the thoIct<br />
VT/S<br />
VS/4T<br />
4VT/3S<br />
3S/VT<br />
<b> VT/3S</b><br />
<br />
14. A trapezoid ABCD is formed by adding the isosceles right triangle BCE with base 5 inches to the rectanqh<br />
ABED where DE Is t Inches. What Is the area of the trapezoid In square Inches?<br />
Pick one of the choices<br />
<b>5t+ 12.5</b><br />
5t + 25<br />
2.5t + 12.5<br />
(t + 5)2<br />
t2+25<br />
<br />
15. Both B and D are prerequisites for E<br />
Both B and C are prerequisites for F<br />
E may occur without B only if A precedes D<br />
A in combination with B is an alternative prerequisites for F<br />
H will occur if E or F occurs, but not if both occur<br />
H in combination with any two unused prerequisites for E or F will yield J<br />
If two sets of prerequisites is sufficient two yield a result both occur, the result will not occur<br />
Any item acts simultaneously as part of all sets of prerequisites of which it is a member and which of the<br />
other members are present<br />
<br />
15 J cannot occur if Pick one of the choices<br />
A is the first item to occur<br />
<b>D is the first item to occur</b><br />
B precedes D<br />
0 A follows B or C<br />
<br />
<br />
16. B precedes D. Which of the following condition is (are) sufficient for H to occur?<br />
<b>I. A occurs but not before D</b><br />
II. C occurs<br />
<b>III. A also precedes D </b><br />
<br />
<br />
17.C occurs. J will occur if Pick one of the choices<br />
B occurs<br />
<b>B and D occur</b><br />
A precedes D<br />
B and D occur, followed by A<br />
A and B occur, followed by D <br />
<br />
<br />
At a baseball game, five nien – L, M, N, 0 and P, and five women – S, T, U, V and W occupy a row of ten seats. The men are in odd numbered seats, starting from the left, each women sits to the right of the man she is dating<br />
2. OisV’sdate<br />
3. W is not at the right end of the row and the man she is dating is not at the left end of the row<br />
4. N Is one seat froiii the right end of the row<br />
5. The man dating W likes T best among the other women and insists on being seated to the right of T<br />
6. M and his date occupy the middle pair of seats<br />
7. V sits next to M<br />
<br />
18.Which of the following could be determined exactly if the position of either L or P were given pick one of the choices<br />
The identity of L’s date<br />
The identity of P’s date<br />
<b>The identity of L’s date or P’s date, but not both</b><br />
<br />
19. In order to determine the position of T, it is necessary to use how many of the numbered statements?<br />
Pick one of the choices<br />
3 4 <b>6</b> 7<br />
<br />
20.If you rearrange the letters ITORSHC you’ll get the name of a famous. Pick one of the choices<br />
City<br />
<b>Animal (Correct)</b><br />
Sportsperson<br />
Movie Starv<br />
<b>Bird</b> <br />
<br />
21.If MILK is written as 1391211 How would you write CURD Pick one of the choices<br />
311073<br />
3121184<br />
221194<br />
223173<br />
<b>None of the above</b><br />
<br />
<br />
George adores classical music. He always prefers Beethoven to Bartok and Mahler to Mozart. He always prefers Haydn to Hindemith and Hindemith to Mozart.He always prefers Mahler to any composer whose name begins with B, except Beethoven, and he always chooses to listen to a composer he prefers.<br />
<br />
23 .George’s brother gives him one recording by each of the composers mentioned. Which of the following correctly states the<br />
order in which George must play some of the records? Pick one of the choices<br />
Beethoven, Bartok, Mozart<br />
Haydn, Hindemith, Mozart<br />
<b>Beethoven, Mahler, Bartok</b><br />
Hindemith, Mahier, Mozart<br />
Haydn, Hindemith, Mahler<br />
<br />
<br />
24.Which of the following can not be true? Pick one of the choices<br />
George prefers Mahler to Bartok<br />
George prefers Beethoven to Mahler<br />
George prefers Bartok to Mozart<br />
<b>George prefers Mozart to Beethoven</b><br />
George prefers Mahler to Haydn<br />
<br />
<br />
25.George’s mother also gives him one recording by each composer mentioned. Which of the following can not occur? Pick one of the<br />
George plays the Beethoven first<br />
George plays the Haydn first<br />
George plays the Mahler third<br />
<b>George plays the Beethoven fifth</b><br />
George plays the Bartok last<br />
<br />
<br />
26.George’s father gives him several records.If the first record he plays is by Berlioz, which of following must be true? Pick one of the choices<br />
There Is no record by Hindemith<br />
There is no record by Bartok<br />
One of the records may be by Haydn<br />
If there Is a record by Haydn, George will play It second<br />
<b>There is no record by Beethoven</b><br />
<br />
Q27 Which number is most unlikely<br />
5 <b>11</b> 17 29 41<br />
<br />
<br />
<br />
Q28 if the annual average receipts from the corporation income tax during the year 1967-1970 equal x then the average annual receipts during this period were about<br />
A. x/4<br />
B. x^2<br />
C. 3x<br />
<b>D. 5x</b><br />
E. x^5<br />
<br />
Q29 The average annual combined outlays for veterans, education and labour, and health and income security was roughly what fraction of the average annual outlay?<br />
A. 1/4<br />
<b>B. 1/3</b><br />
C. 2/5<br />
D. 1/2<br />
E. 2/3<br />
<br />
<br />
Q30 if 5/8 of the average annual outlays for agriculture was spent in the wentern US, what percentage of average annual outlays was spent on agriculture in the western US?<br />
A. 5/8<br />
B. 1<br />
C. 5/4<br />
<b>D. 2</b><br />
E. 3.2</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-52062405275812800782018-08-17T23:18:00.007+05:302021-05-09T19:51:44.381+05:30Amazon Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Amazon SDE II Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" style="margin-left: 1em; margin-right: 1em;"><img alt="Amazon SDE II" border="0" data-original-height="415" data-original-width="739" height="112" src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" title="Amazon SDE II Interview" width="200" /></a></div><br />
<br />
Written Round<br />
Q1 Given 2 versioned strings A and B. Check if A>B<br />
Return<br />
1 if A>B,<br />
-1 if A<b p="">0 if A==B <br />
<br />
Example #1<br />
101.2.3.2 - A<br />
101.1.3.1 - B<br />
Here A>B because 101 is same but 2>1 and we return 1<br />
<br />
Example #2<br />
10.3.4 - A<br />
10.7 - B<br />
Here B>A because 7>3 thus return -1<br />
<a name='more'></a><br />
<br />
Q2 Given a binary tree, check if its a Binary Search Tree or not.<br />
<br />
<br />
Interview Round 1<br />
Q1 Given arrival time and departure time of trains, we need to find the minimum number of platforms needed for the trains.<br />
<br />
Q2 Given a matrix for 0's and 1's. We need to find the cost of minimum path to reach from point A to point B in the matrix.<br />
Point A and B are given as input along with the matrix.<br />
In the matrix,<br />
0's indicate no path<br />
1 indicate a path<br />
<br />
Note: You can only go up, down, left or right from a given point in matrix.<br />
<br />
<br />
Interview Round 2<br />
Q1 Subset Sum Problem - <a href="https://www.geeksforgeeks.org/subset-sum-problem-osum-space/" target="_blank">Solution</a><br />
<br />
Q2 Given a binary search tree where 2 of its nodes are swapped, you need to find the offending nodes and return the correct binary tree in O(n) time. - <a href="https://www.geeksforgeeks.org/fix-two-swapped-nodes-of-bst/" target="_blank">Solution</a></b></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-90415375824073547362018-06-10T15:22:00.003+05:302021-04-25T10:30:43.689+05:30Amazon Senior SDE Interview Experience<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Amazon Senior SDE Interview Experience</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="415" data-original-width="739" height="112" src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSaVW7xcldT93rAt6UNwv9gm2gAGrjRB_iGjf2qMHFIFfRflMMG" width="200" /></a></div><br />
<br />
<b>Written Test - 3 questions</b><br />
Q1 <a href="https://dausel.co/El8Aso" target="_blank">Maximum Contiguous Sum Subarray</a><br />
<br />
Q2 <a href="https://dausel.co/z0y73f" target="_blank">Rope Length</a> - Connect n ropes with minimum cost.<br />
<br />
Q3 <a href="https://dausel.co/bRxAKi" target="_blank">Left View of a Tree</a><br />
<br />
<br />
<b>Interview - Round 1</b><br />
Q1 <a href="https://dausel.co/749vbY" target="_blank">Dutch National Flag Problem</a><br />
<br />
Q2 Suggest a <a href="https://dausel.co/6YM1vn" target="_blank">data structure</a> for stocks buy and sell where sellers can add stock to sell and you can match a buyer with the best bid.</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-91189008025686185382018-05-13T11:26:00.002+05:302021-05-09T19:13:09.673+05:30Microsoft SWE hackerrank questions<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<span id="goog_1526810457"></span><span id="goog_1526810458"></span> <u>Microsoft SWE hackerrank questions</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://smedia2.intoday.in/btmt/images/stories/microsoft-660_042518074140.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="450" data-original-width="660" height="136" src="https://smedia2.intoday.in/btmt/images/stories/microsoft-660_042518074140.jpg" width="200" /></a></div><br />
<br />
Q1 Given the preorder and inorder traversal of binary tree, find the postorder traversal<br />
<br />
INPUT<br />
preorder -> 37, 41, 43, 13, 5, 11, 29, 23, 2, 17, 47, 7, 3, 19, 31<br />
inorder -> 13, 5, 43, 11, 41, 2, 23, 17, 29, 47, 37, 3, 7, 31, 19<br />
<br />
Pick one of the choices<br />
A) 5,13,11,43,2,17,23,47,29,41,31,19,7,3,37<br />
<b>B) 5,13,11,43,2,17,23,47,29,41,3,31,19, 7,37</b><br />
C) 5,13,11,43,47,29,2,17,23,41,3,31,19, 7,37<br />
D) 5,13,11,2,17,23,43,47,29,41,3,31,19, 7,37<br />
<br />
Q2 Select the function with highest asymptotic complexity<br />
A) f1(n) = n^0.999999 logn<br />
B) f2(n) = 10000000n<br />
<b>C) f(n) = n^2</b><br />
D) f3(n) = 1.000001^n<br />
<br />
Q3 Calculate the complexity to merge sorted arrays of size k1, k2, k3 ... kn<br />
for e.g.<br />
k1 = 2,5<br />
k2 = 1,4,8<br />
k3 = 3<br />
find complexity to merge k1, k2 and k3. the resulting array will be: R = 1,2,3,4,5,8<br />
<br />
<b>A) (k1 + k2 + ... + kn) * n </b><br />
B) n * k1 * k2 * k3 * ... * kn<br />
C) (k1 + k2 + ... + kn) * log2n<br />
D) n2<br />
<br />
Q4 Sort a integer singly linked of size n in batches of k nodes<br />
Given singly linked list of integers of size n, sort the linked list in increasing order in batches of k nodes.<br />
For e.g. the input singly linked list, L = 4 -> 8 -> 3 -> 9 -> 1 -> 3 -> null and batch of k nodes= 3 <br />
Please note that in above e.g. 4->8->3 is first batch of k(3) nodes and 9-> 1->3 is second batch of k(3) nodes. <br />
The output of your function should be: 3 -> 4 -> 8 -> 1 -> 3 -> 9 -> null <br />
<br />
Q5 Calculate the count of Combinations given a collection of size n and you need to choose k items from the collection<br />
Given a collection of items of size n, you need to find total count of combinations to select k items from the collection. The formula to calculate the combination is:<br />
nCr = n! / (n-r)! * r!<br />
For e.g. if collection size is. 100 and items to select are 2, then choose k is (100 * 99)/(2 * 1) = 4950<br />
<br />
Hit like if these questions help you...!!!</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-3428299406894984742017-12-03T13:26:00.001+05:302017-12-03T13:32:53.857+05:30Which Cryptocurrency Should You Invest In Before 2018?<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Top cryptocurrencies to invest before 2018</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cdn-images-1.medium.com/max/1201/1*gGWo94mRg4v6QYs5Lr7Cdg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="450" data-original-width="800" height="180" src="https://cdn-images-1.medium.com/max/1201/1*gGWo94mRg4v6QYs5Lr7Cdg.png" width="320" /></a></div>
Cryptocurrency is definitely a popular topic these days especially since Bitcoin just reached an all time high of $11,600 per coin. The question is, which cryptocurrency should you invest in by 2018? Will there be another coin that peaks as much as Bitcoin? Will we miss the opportunity yet again?<br />
<br />
There are currently at least 1,000 different types of coins as listed on Coinmarketcap. Nobody knows for certain which one will prevail, but we normally look at certain traits to see if a coin has potential or not.<br />
But rather than going into technicals and confusing you, here is my recommendation for you<br />
<br />
1. <a href="http://p.pw/bajBPK" target="_blank">Ark</a> - $4.10 USD<br />
ARK provides users, developers, and startups with innovative blockchain technologies. We aim to create an entire ecosystem of linked chains and a virtual spiderweb of endless use-cases that make ARK highly flexible, adaptable, and scalable. ARK is a secure platform designed for mass adoption and will deliver the services that consumers want and developers need. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzL62p1RRK0JmCGIDouXpW9G-oCV2Ze0_gqPzitv0ijcJrWZTK1exf8d12pfwtymxNkO7HRFtlHxcAzww-kna94k7_Vnli7Kqp3x8mkb3MS_vaIgZylSDeMgxOwkywes4JjtlqT5F9mu8/s1600/Screen+Shot+2017-12-03+at+1.11.24+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1393" data-original-width="1540" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzL62p1RRK0JmCGIDouXpW9G-oCV2Ze0_gqPzitv0ijcJrWZTK1exf8d12pfwtymxNkO7HRFtlHxcAzww-kna94k7_Vnli7Kqp3x8mkb3MS_vaIgZylSDeMgxOwkywes4JjtlqT5F9mu8/s320/Screen+Shot+2017-12-03+at+1.11.24+PM.png" width="320" /></a></div>
<br />
<a name='more'></a><br />
<br />
2. <a href="http://p.pw/bajBPL" target="_blank">Monero</a> - $201.75 USD<br />
Monero is a secure, private, and untraceable cryptocurrency. It is open-source and accessible to all. With Monero, you are your own bank. Only you control and are responsible for your funds. Your accounts and transactions are kept private from prying eyes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsnCvAYfWA7dc8GRPBrjc09fVrrsY1XaZqktuwsGI5PeglRtpX4uI8lzY6vVZlmn-wWnrsq_1S3qJD86cyAe84VWJ2JskEolh4SpE1rw90jD-gvySqXBKLr-5cK6KKHy48D-h7I4IjWos/s1600/Screen+Shot+2017-12-03+at+1.11.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1398" data-original-width="1532" height="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsnCvAYfWA7dc8GRPBrjc09fVrrsY1XaZqktuwsGI5PeglRtpX4uI8lzY6vVZlmn-wWnrsq_1S3qJD86cyAe84VWJ2JskEolh4SpE1rw90jD-gvySqXBKLr-5cK6KKHy48D-h7I4IjWos/s320/Screen+Shot+2017-12-03+at+1.11.47+PM.png" width="320" /></a></div>
<br />
3. <a href="http://p.pw/bajBPM" target="_blank">Ethereum</a> - $470.51 USD<br />
Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference.<br />
These apps run on a custom built blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of property.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe0NPIF0eBsDTMWIupWQeBVwy6vP3kkt_4pVA2syXLMoymUIXKa7D3PHaQfEvaG_PXZi9zxvqcHRENK8MMTWVJEHfO0K8t6DY26uf__jG79SY6MnUIXzVz7kn4-k1OD8ZYDNiDV6fL3jw/s1600/Screen+Shot+2017-12-03+at+1.12.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1452" data-original-width="1548" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe0NPIF0eBsDTMWIupWQeBVwy6vP3kkt_4pVA2syXLMoymUIXKa7D3PHaQfEvaG_PXZi9zxvqcHRENK8MMTWVJEHfO0K8t6DY26uf__jG79SY6MnUIXzVz7kn4-k1OD8ZYDNiDV6fL3jw/s320/Screen+Shot+2017-12-03+at+1.12.47+PM.png" width="320" /></a></div>
</div>
4. <a href="http://p.pw/bajBPN" target="_blank">IOTA</a> - $1.46 USD<br />
The main innovation behind IOTA is the Tangle, a revolutionary new blockless distributed ledger which is scalable, lightweight and for the first time ever makes it possible to transfer value without any fees. Contrary to today’s Blockchains, consensus is no-longer decoupled but instead an intrinsic part of the system, leading to decentralized and self-regulating peer-to-peer network<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFcxxFENKrPvrgjtkr_ALToKimQ5B_4Qg2bgnS5Cuk8rFttLtWuQm1syYuOg8qS6Cvo31vA1eKOlh7mHxTNxtodZxjQYxrM8S71JgeXXnxoDdJfVpNvGTBZ1_3SZs8UOc5cUqZghe2o-c/s1600/Screen+Shot+2017-12-03+at+1.14.17+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1398" data-original-width="1516" height="295" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFcxxFENKrPvrgjtkr_ALToKimQ5B_4Qg2bgnS5Cuk8rFttLtWuQm1syYuOg8qS6Cvo31vA1eKOlh7mHxTNxtodZxjQYxrM8S71JgeXXnxoDdJfVpNvGTBZ1_3SZs8UOc5cUqZghe2o-c/s320/Screen+Shot+2017-12-03+at+1.14.17+PM.png" width="320" /></a></div>
<br />
5. <a href="http://p.pw/bajBPO" target="_blank">Ripple</a> - $0.256274 USD<br />
Ripple connects banks, payment providers, digital asset exchanges and corporates via RippleNet to provide one frictionless experience to send money globally.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi0ppK8_eBZ5Lnyo8WegFpqam82nfvOZisLkt-QunuVlcQ1gogyEdjxFiWmysjyiTELrdNbYh6DCqC4YRVZxPFVqIsJdehCyeXDuiRd8TVEWkB9G3PDAG2GGncxE8FR-6ndzT3xNX987A/s1600/Screen+Shot+2017-12-03+at+1.14.37+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1388" data-original-width="1544" height="287" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi0ppK8_eBZ5Lnyo8WegFpqam82nfvOZisLkt-QunuVlcQ1gogyEdjxFiWmysjyiTELrdNbYh6DCqC4YRVZxPFVqIsJdehCyeXDuiRd8TVEWkB9G3PDAG2GGncxE8FR-6ndzT3xNX987A/s320/Screen+Shot+2017-12-03+at+1.14.37+PM.png" width="320" /></a></div>
<br />
6. <a href="http://p.pw/bajBPP" target="_blank">Steem</a> - $1.24 USD<br />
Steem is a blockchain-based rewards platform for publishers to monetize content and grow community.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxwWs7EriN6AFiiLy1jZSxwXERisVmUi2EZ30S5vFdgEJ-MEHL8EBqojXeEpLfCwyGtcAZ5eePv7fsWRhnPOcZxSQ_1RgAEgVD3sQ7vTThbyGULvwYbknU5_M1VvKlQFA4_Euo1Bod5mo/s1600/Screen+Shot+2017-12-03+at+1.15.12+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1426" data-original-width="1478" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxwWs7EriN6AFiiLy1jZSxwXERisVmUi2EZ30S5vFdgEJ-MEHL8EBqojXeEpLfCwyGtcAZ5eePv7fsWRhnPOcZxSQ_1RgAEgVD3sQ7vTThbyGULvwYbknU5_M1VvKlQFA4_Euo1Bod5mo/s320/Screen+Shot+2017-12-03+at+1.15.12+PM.png" width="320" /></a></div>
<br />
<br />
To invest in these coins from India<br />
1. Create an account on <a href="https://koinex.in/?ref=3c2681" target="_blank">Koinex</a><br />
2. Buy bitcoins or other crypto from these exchange.<br />
3. Transfer those crypto to Bittrex (<a href="https://bittrex.com/" target="_blank">click</a> to get account)<br />
4. Use bitcoins to buy above cryptocurencies or if you transfer other coins say Ripple or Litecoin, first convert them into USDT or Bitcoin on bittrex and then use those to buy above cryptos.</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com1tag:blogger.com,1999:blog-7795153922499567758.post-34335049243970679862017-12-03T12:57:00.000+05:302017-12-03T15:44:35.835+05:30How to buy bitcoin in India<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Best websites to invest in cryptocurrencies in India </u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.welivesecurity.com/wp-content/uploads/2017/09/cryptocurrency_estonia-623x432.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="432" data-original-width="623" height="221" src="https://www.welivesecurity.com/wp-content/uploads/2017/09/cryptocurrency_estonia-623x432.jpg" width="320" /></a></div>
Cryptocurrency in India is gaining momentum. However, there is only a handful quality sites where you can buy & sell Bitcoin and other cryptos.<br />
It is still in the early stage and the best time for you to enter the market and make some good returns. Investing 1-5% is the best idea to make a decent portfolio for the future and you can invest a minimum of 1000 bucks atleast to get a good taste of this emerging market.<br />
<br />
<div style="text-align: left;">
Here I’m listing down those Indian Bitcoin exchange websites that you can use to buy and sell Bitcoin. I am listing these websites based to popularity and best fee structure so you get the most benefit.<br />
<a name='more'></a><br />
<br />
<i><b>My Recommendation - Start with Zebpay and Koinex (links below)</b></i><br />
<b>Zebpay</b> - Since this is the very first Indian exchange the started the wave of bitcoins in India, I consider this the most secure to keep your bitcoins. If you want to make a good investment of 50K+ for long term then make an account here, buy some bitcoins now and check back in 4 months so see your investment double. <br />
<br />
<b>Coinsecure</b> - More of a trading website if you want to buy/sell bitcoins daily<br />
<br />
<b>Koinex</b> - Again a trading websites, although still in beta phase. They are doing a really good job. They support multiple currencies so that is a plus point. To add to that they dont change sell fees till dec 31st so make most use of it. <br />
<br />
<b>Unocoin</b> - Since this is most expensive, I will not recommend it for starters.<br />
<br />
<b>Coinome</b> - It is relatively new but backed by Billdesk so that is a plus point. It has a dynamic pricing and it also supports DASH which i don't think is supported by any other exchange.</div>
<br />
<!--Table Code Start-->
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTable15Grid1LightAccent1" style="border-collapse: collapse; border: none; width: 517px;">
<tbody>
<tr>
<td style="border-bottom: solid #8eaadb 1.5pt; border: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Company</b></div>
</td>
<td style="border-bottom: solid #8eaadb 1.5pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
<b>Web/Mobile App</b></div>
</td>
<td style="border-bottom: solid #8eaadb 1.5pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
<b>Supported Currency</b></div>
</td>
<td style="border-bottom: solid #8eaadb 1.5pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
<b>Pricing/Fees</b></div>
</td>
<td style="border-bottom: solid #8eaadb 1.5pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<b>Link</b></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid #b4c6e7 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Zebpay</b></div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
Android</div>
<div class="MsoNormal">
iOS</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
Bitcoin</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
SignUp - Free</div>
<div class="MsoNormal">
Buy - 0.25% + GST</div>
<div class="MsoNormal">
Sell - 0.25% + GST</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Deposit</div>
<div class="MsoNormal">
NEFT/RTGS/IMPS - Based on bank charges</div>
<div class="MsoNormal">
Payment Gateway - 2%</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Withdrawl - Rs10 Flat</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<a href="http://link.zebpay.com/ref/REF15359686" target="_blank">Android App</a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<a href="http://link.zebpay.com/ref/REF15359686" target="_blank">iOS App</a></div>
</td>
</tr>
<tr style="height: 12.75pt;">
<td style="border-top: none; border: solid #b4c6e7 1.0pt; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Coinsecure</b></div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
Android</div>
<div class="MsoNormal">
Web</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
Bitcoin</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
SignUp - Free</div>
<div class="MsoNormal">
Buy - 0.30% + GST</div>
<div class="MsoNormal">
Sell - 0.30% + GST</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Deposit</div>
<div class="MsoNormal">
NEFT/RTGS/IMPS - Based on bank charges</div>
<div class="MsoNormal">
Payment Gateway - 2%</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Withdrawl - Rs10 Flat</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<a href="https://coinsecure.in/signup/Zk1IHdxsPgtmybegJgj9" target="_blank">Register Here</a></div>
</td>
</tr>
<tr style="height: 12.75pt;">
<td style="border-top: none; border: solid #b4c6e7 1.0pt; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Koinex</b></div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
Web</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
Bitcoin</div>
<div class="MsoNormal">
Ethereum</div>
<div class="MsoNormal">
Litecoin</div>
<div class="MsoNormal">
Ripple</div>
<div class="MsoNormal">
Bitcoin Cash</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
SignUp - Free</div>
<div class="MsoNormal">
Buy - 0.20% + GST</div>
<div class="MsoNormal">
Sell - Free (Till Dec 31<sup>st</sup>)</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Deposit</div>
<div class="MsoNormal">
NEFT/RTGS/IMPS - Based on bank charges</div>
<div class="MsoNormal">
Payment Gateway - 2%</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Withdrawl - Free</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<a href="https://koinex.in/?ref=3c2681" target="_blank">Register Here</a></div>
</td>
</tr>
<tr style="height: 12.75pt;">
<td style="border-top: none; border: solid #b4c6e7 1.0pt; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Unocoin</b></div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
Android</div>
<div class="MsoNormal">
iOS</div>
<div class="MsoNormal">
Web</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
Bitcoin</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
SignUp - Free</div>
<div class="MsoNormal">
Buy - 1.00% + GST</div>
<div class="MsoNormal">
Sell - 1.00% + GST</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Deposit</div>
<div class="MsoNormal">
NEFT/RTGS/IMPS - Based on bank charges</div>
<div class="MsoNormal">
Payment Gateway - 2%</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Withdrawl - Free</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 12.75pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<a href="https://www.unocoin.com/" target="_blank">Register Here</a></div>
</td>
</tr>
<tr style="height: 13.5pt;">
<td style="border-top: none; border: solid #b4c6e7 1.0pt; height: 13.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 84.8pt;" valign="top" width="85"><div class="MsoNormal">
<b>Coinome</b></div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 13.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.9pt;" valign="top" width="86"><div class="MsoNormal">
Web</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 13.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 85.8pt;" valign="top" width="86"><div class="MsoNormal">
Bitcoin</div>
<div class="MsoNormal">
Ethereum</div>
<div class="MsoNormal">
Litecoin</div>
<div class="MsoNormal">
Ripple</div>
<div class="MsoNormal">
Dash</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 13.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 140.15pt;" valign="top" width="140"><div class="MsoNormal">
SignUp - Free</div>
<div class="MsoNormal">
Buy - 1.00% + GST</div>
<div class="MsoNormal">
Sell - 1.00% + GST</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Deposit</div>
<div class="MsoNormal">
NEFT/RTGS/IMPS - Based on bank charges</div>
<div class="MsoNormal">
Payment Gateway - 2%</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Withdrawl - Free</div>
</td>
<td style="border-bottom: solid #b4c6e7 1.0pt; border-left: none; border-right: solid #b4c6e7 1.0pt; border-top: none; height: 13.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 120.5pt;" valign="top" width="121"><div class="MsoNormal">
<a href="https://www.coinome.com/" target="_blank">Register Here</a></div>
</td>
</tr>
</tbody></table>
<!--Table Code End-->
<br />
<br /></div>
</div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com0tag:blogger.com,1999:blog-7795153922499567758.post-46180378002940419782017-10-15T18:55:00.001+05:302017-10-15T18:55:20.204+05:30Automation Testing Selenium Web Driver and NodeJS with Mocha Framework<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<u>Selenium Web Driver and Mocha Framework - NodeJS WebApplication Automation Testing</u></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cms-assets.tutsplus.com/uploads/users/329/posts/21855/preview_image/preview.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="277" data-original-width="400" height="221" src="https://cms-assets.tutsplus.com/uploads/users/329/posts/21855/preview_image/preview.jpg" width="320" /></a></div>
I recently had a task to write test automation framework using selenium. The most obvious idea that came was to use Java with selenium, but knowing the web app i was to test was primarily in JavaScript, it was strange to write tests in Java.<br />
So i decided to use Selenium bindings for JavaScript. The only problem was the support available. Every small thing related to selenium was available in Java but it was a pain finding similar implementations for NodeJS.<br />
<br />
In this post, I am going to take you through the process of getting setup and running a simple JavaScript based test using Selenium, NodeJS and Mocha.<br />
In subsequent posts, we will extend these tests and configure use of network calls inspector such as browsermob-proxy, running tests on multiple browsers etc.<br />
<a name='more'></a><br />
<br />
<u><b>Installing Node.js</b></u><br />
Ok so first step is to get Node.js installed. We will use nvm (Node Version Manager) so that we can manage and switch versions easily.<br />
Firstly you need brew, if you use windows <a href="https://github.com/creationix/nvm#installation" target="_blank">visit here</a><br />
<br />
<div style="background: #ffffff; border: none; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;">brew update
brew install nvm
mkdir ~/.nvm
nano ~/.bash_profile
</pre>
</div>
<br />
In your .bash_profile file (you may be using an other file, according to your shell), add the following :<br />
<br />
<div style="background: #ffffff; border: none; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007020;">export </span><span style="color: #996633;">NVM_DIR</span><span style="color: #333333;">=</span>~/.nvm
<span style="color: #007020;">source</span> <span style="color: #008800; font-weight: bold;">$(</span>brew --prefix nvm<span style="color: #008800; font-weight: bold;">)</span>/nvm.sh
</pre>
</div>
<br />
Back to your shell, activate nvm and check it (if you have other shells opened and you want to keep them, do the same) :<br />
<br />
<div style="background: #ffffff; border: none; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #007020;">source</span> ~/.bash_profile
<span style="color: #007020;">echo</span> <span style="color: #996633;">$NVM_DIR</span>
</pre>
</div>
<br />
To list the node versions available run:<br />
nvm list-remote<br />
To install your specific node version run:<br />
nvm install v7.10.0<br />
<br />
To switch to a different node version run:<br />
nvm use v6.11.1<br />
<br />
To have a node activated by default, run:<br />
nvm alias default v7.10.0<br />
<br />
Ok so now you have node installed, run node on terminal to get the node prompt. If you get node prompt all good else you messed something during above steps. Use <b>.exit</b> to quit<br />
<br />
<u><b>Installing and Setting Up Selenium</b></u><br />
Ok now lets create a basic selenium tests. I know everyone uses IRCTC in India so lets see how we can automate logging on IRCTC :)<br />
Create a directory and cd into it<br />
mkdir selenium-test-1<br />
cd selenium-test-1<br />
<br />
1. Install selenium-webdriver and chromedriver<br />
<b>npm install selenium-webdriver</b><br />
<b>npm install chromedriver</b><br />
<b>Note:</b> you can use -g switch to install it globally, --save switch to save it in your package.json <br />
After installation, these should be present in the node_modules directory.<br />
<br />
2. Run command node to start the node prompt. Now on the node prompt, we will run the commands to setup selenium and run automated tests.<br />
First we need to require selenium-webdriver and chromedriver using below commands.<br />
<b>var webdriver = require('selenium-webdriver');</b><br />
<b>require('chromedriver');</b><br />
<br />
selenium-webdriver has exported a Builder variable which we will use the build the driver as below<br />
<b>var driver = new webdriver.Builder().forBrowser('chrome').build();</b><br />
This should open the chrome instance, if all goes well<br />
<br />
Now we will use the driver to run tests. get method will open the website in the chrome instance.<br />
driver.get('https://www.irctc.co.in/');<br />
selenium-webdriver has exported a <b>By</b> variable using which we can query for DOM elements by name, id or class.<br />
<br />
<b>driver.findElement(webdriver.By.name('j_username')).sendKeys('username');</b><br />
<b>driver.findElement(webdriver.By.name('j_password')).sendKeys('password');</b><br />
<b>driver.findElement(webdriver.By.name('nlpAnswer')).sendKeys('3TSRX7');</b><br />
<b>driver.findElement(webdriver.By.name('submit')).click();</b><br />
<b>driver.quit(); </b><br />
<br />
If credentials are correct, you should get logged into irctc.<br />
<br />
You can add this code to a test.js file and execute it by running:<br />
node test.js<br />
<br />
<u><b>Adding Mocha Test Framework to your code</b></u><br />
Mocha is a test framework commonly used to write unit tests for JavaScript code, but we can also use it as a driver to driver our selenium tests when using Selenium with Node. <br />
<br />
First thing first - Installing mocha<br />
<b>npm install mocha --save</b><br />
<br />
1. Writing our first test - create a new file called mocha_test.js with following contents<br />
<br />
<div style="background: #ffffff; border: none; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">var</span> assert <span style="color: #333333;">=</span> require(<span style="background-color: #fff0f0;">'assert'</span>),
webdriver <span style="color: #333333;">=</span> require(<span style="background-color: #fff0f0;">'selenium-webdriver'</span>);
describe(<span style="background-color: #fff0f0;">'Google Search'</span>, <span style="color: #008800; font-weight: bold;">function</span>() {
<span style="color: #008800; font-weight: bold;">let</span> driver;
before(async() <span style="color: #333333;">=></span> {
driver <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> webdriver.Builder().
forBrowser(<span style="background-color: #fff0f0;">'chrome'</span>).
build();
});
after(async() <span style="color: #333333;">=></span> {
await driver.quit();
});
it(<span style="background-color: #fff0f0;">'should work'</span>, async () <span style="color: #333333;">=></span> {
await driver.get(<span style="background-color: #fff0f0;">'http://www.google.com'</span>);
<span style="color: #008800; font-weight: bold;">var</span> searchBox <span style="color: #333333;">=</span> await driver.findElement(webdriver.By.name(<span style="background-color: #fff0f0;">'q'</span>));
await searchBox.sendKeys(<span style="background-color: #fff0f0;">'simple programmer'</span>);
await searchBox.getAttribute(<span style="background-color: #fff0f0;">'value'</span>).then(<span style="color: #008800; font-weight: bold;">function</span>(value) {
assert.equal(value, <span style="background-color: #fff0f0;">'simple programmer'</span>);
});
});
});
</pre>
</div>
<br />
You can execute the test by typing:<br />
mocha mocha_test.js<br />
<br />
Now to understand the various blocks used in this test <a href="https://mochajs.org/" target="_blank">visit here</a><br />
<br />
2. Running tests on firefox<br />
You need gecko driver to run tests in firefox. Lets install it<br />
<b>npm install geckodriver --save</b><br />
<br />
Creating driver to use firefox is more or less similar<br />
<b>var driver = new webdriver.Builder().forBrowser('chrome').build();</b><br />
<b><br /></b>
<b>A point of advice</b> - usually the default timeout of mocha tests are 2000ms, which means one it block cannot take more than 2000 ms. Mozilla startup is a bit slow as compared to chrome so i had to increase the timeout otherwise the tests used to fail with timeout error<br />
run using:<br />
mocha -t 4000 mocha_test.js<br />
<br />
3. Running tests on safari<br />
If you are using the latest version of MacOS - then safari comes pre-shipped with its driver so no need to install a separate driver. It is present in /usr/bin/safaridriver<br />
The only problem I faced at the time of writing this posts is the safaridriver was for Safari v11 but Mac still had Safari v10.3 and my tests were failing.<br />
<br />
I struggled on the internet to find that there is a safari-technology-preview on which we can run the tests but no resource of how to pass this fucking switch with capabilities. Below is how you can do that now since i know:<br />
<br />
<div style="background: #ffffff; border: none; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;">global.driver <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">new</span> webdriver.Builder()
.withCapabilities({
<span style="background-color: #fff0f0;">'safari.options'</span><span style="color: #333333;">:</span> {
<span style="background-color: #fff0f0;">'technologyPreview'</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">true</span>
}
})
.forBrowser(<span style="background-color: #fff0f0;">'safari'</span>)
.build();
</pre>
</div>
<br />
You must download the Safari Technology Preview first before using it this way. If you do now want to use the Safari Technology Preview, you will have to download the beta version of Safari v11 in order to successfully run the tests on safari.<br />
<br />
<u><b>Adding Chai assertion library</b></u><br />
Again first thing is installation<br />
npm install chai --save<br />
<br />
var chai = require('chai');<br />
var expect = require('chai').expect;<br />
<br />
Now you can use expect using these examples <a href="http://chaijs.com/api/bdd/" target="_blank">here</a></div>
Blaze Starhttp://www.blogger.com/profile/07752172928967657762noreply@blogger.com1