<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohamed Habib on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Habib on Medium]]></description>
        <link>https://medium.com/@motatoes?source=rss-bb1569aa7ee4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P3nDxaoHw7EvYNGQgt46gA.jpeg</url>
            <title>Stories by Mohamed Habib on Medium</title>
            <link>https://medium.com/@motatoes?source=rss-bb1569aa7ee4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:12:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@motatoes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[We launched to ProductHunt in 48 hours]]></title>
            <link>https://motatoes.medium.com/we-launched-digger-to-product-hunt-in-48-hours-730f6d1841f4?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/730f6d1841f4</guid>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 19:19:55 GMT</pubDate>
            <atom:updated>2021-07-10T20:40:44.237Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Actually the title is not so accurate. That was our initial plan. But before you get confused allow me to explain the context around this launch and what happened. <a href="https://www.producthunt.com/posts/digger">Today we launched Digger on ProductHunt</a>.</p><p>I have been working on Digger along with my cofounder Igor since last January. We have raised a small pre-seed round as a part of an accelerator called EntrepreneurFirst. What brought us together was the shared vision of making deploying to the cloud (AWS) easier. I knew this was a problem because the first time I wanted to deploy my previous product to AWS it took me a week to figure out. It was a frustrating experience to say the least. Igor also shared the same experiences</p><h3>Where to start?</h3><p>Now that we have identified the problem what would be the next step. Build the solution right? Wrong. There are mixed opinions about this next step. There is no right or wrong answers. But a lot of people tend to jump into building without first understanding the problem in a deep enough sense. For us we knew that a problem existed but wanted to validate if it was common enough. The easy way to do that would be to speak to a lot of people. So we spoke to about 100 different stakeholders from engineers to managers through Devops engineers. We found a pattern that existed in larger companies where many of them seem to be building the same internal tooling to help with devops. This tooling would abstract away the complexities of deploying to AWS. Some even called this an “easy button” which would deploy to the cloud of . Yes indeed, the tooling is specific to their own technologies but the concepts remain the same.</p><p>Equipped with this information we got enough information to build our first prototype. During any build phase we are very cautious not to be disconnected from our users and customers. This is a big trap of going into a cave and building something then coming out with a v1 of your product that everyone loves. Actually it never happens this way. The first version of you product will always be sh*tty (pardon my french). And so will the second and third. It is through iteration and improvement that you get to what your users really need. And how will you know if you are building the right thing? That’s right .. by talking to your customers.</p><h3>Sell early</h3><p>Your users will always give you positive feedback. People like being nice. How can you tell if they are honest with you? The answer lies in whether they can reach out and start paying you for what you have to offer. If you can get enough people to start paying you for an early version of what you are building then you know that you are on the right track. Landing your first paying customer is usually the hardest but getting more becomes easier. This is where things like ProductHunt launches may help. Although many times your first customer is already someone you know like a friend or a linkedin connection.</p><p>Therefore, as soon as you have the least functioning version of your product start selling it. During this process you will learn one of two things. A) People will get excited and buy it means you are in the right direction or B) you will fail to sell after talking to X number of people. If B) is the case then you need to infer where you went wrong by understanding the real needs of these people and then iterate. This is why we know that v1 rarely happens on the first time. Iteration is key.</p><p>For us it took a few attempts of building and selling until we landed our first customer around May. Then another one came, and another one. Until we got to nearly 10 customers. Once we saw enough signs of traction, we decided to re-apply to <a href="https://www.ycombinator.com/">Ycombinator</a>. I’m saying re-apply because we had already interviewed with them earlier before January in pre-product phase but they decided to not fund us because our product design was not clear. Now we are applying again but this time with paying customers.</p><p>Long story short, we re-applied to YCombinator but didn’t get in. Here is the response we received</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Cq9wHehpaR28D5ItYWj0A.png" /></figure><h3>From hand-holding to self-service</h3><p>One thing I didn’t mention above was about the way we acquired our first 10 customers. Since the features were not totally clear we often had to do manual onboarding. This means us being human-in-the-loop and setting up their stacks by ourselves. Its kind of like having a product but not exactly a product because you are doing things behind the scenes. We know that this does not scale we found it to be the best way to learn about what our customers wanted.</p><p>Based on the YCombinator feedback above it was time to think about something different. So I dicussed with my co-founder and we came to the following framework: What would it take us for someone to discover our product through landing page and convert to a paid customer?</p><p>It is from here that we discovered a new factor to add this: <strong>launching on product hunt. </strong>Igor then left me a comment on slack that night saying:</p><blockquote>What if we launched on producthunt in the next 48 hours? I think it could serve as a useful milestone / forcing function<br>surely if we think that we solved the repeatability challenges then the launch would be beneficial? and if there are doubts then we haven’t really solved the repeatability challenges what follows is that we should aim to launch on ProductHunt the sooner the better. Set a date and work towards it</blockquote><p>Of course I went outrageous about his comment. How can we launch to product hunt now? We are totally not ready yet. Our product is not polished enough. We don’t have enough customers. We don’t have enough features. But somehow we jumped on a call and he managed to convince me to do it. We started with a launch date and then worked backwards from there. Unfortunately that list was not very short:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*bd35qOz0jbVZcjg4X1BVOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*eD1mtzbzIZQRZKQ5RrWTmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wo9rTXZLWfoi2RiBQIm4mg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*y3U6TYyfDKsrnUyJjGEkmA.png" /></figure><p>So it took us over two days to cover all of these features but eventually we got there. And you know what? We would have never gotten there if we never set a launch deadline. Something strange happens when you set a deadline. It forces you to act faster and focus on what’s important, as Mike Tyson puts it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*BnFW6ylDwvspNOMQZoyWxg.jpeg" /></figure><h3>You will never feel ready</h3><p>The truth is: You will never feel like you are ready for a “launch” because there is always some polish to be made. As a result I would encourage you to <strong>force yourself </strong>to launch earlier. Think about what “must be” present for your launch and all the other auxillary polish which are optional and can be done later. This will allow you to focus on whats important AND get feedback early. <strong>Learning</strong> is a key element for startups.</p><blockquote>Time will force you to get creative with what you are building</blockquote><p>So to summarise this article in a few sentences: Launch before you are ready. Use time boxing in your favour and force you to limit scope. Always be selling, and always be iterating ;)</p><p>If you found this article useful, or got some follow-ups with me drop me a <a href="https://twitter.com/_motatoes_">follow on twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=730f6d1841f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I just landed a developer job at Amazon London: Here is how I prepped for it]]></title>
            <link>https://motatoes.medium.com/i-just-landed-a-developer-job-at-amazon-london-here-is-how-i-prepped-for-it-ac213da724b2?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac213da724b2</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[london]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Sat, 16 Nov 2019 11:27:04 GMT</pubDate>
            <atom:updated>2019-12-12T18:47:10.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y77pko3g13t1goOkXjMvZA.jpeg" /><figcaption>I have joined Prime Video team in November as a Software Developer</figcaption></figure><p>I have recently received an offer from amazon to join their Prime Video team in London. I went through a normal application process through their website. This means I did not receive any internal referrals, all I did was apply to an advert on the <a href="http://amazon.jobs/">amazon.jobs</a> website. I got shortlisted through the rounds and finally cleared the onsite to receive an offer. I will be joining Amazon in September, exciting times! The reason I am writing this post is to offer advice to prospective candidates who wish to apply for Amazon, specifically in their London office. I realise there are plenty of posts about how to get into tech giants (<a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwimuJGB_7LkAhXi6aYKHa97A-8QFjAAegQIARAB&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFacebook%2C_Apple%2C_Amazon%2C_Netflix_and_Google&amp;usg=AOvVaw2pdxaiIqzdkHAW5w18CPqI">FAANG</a>), and alot of their advice applies here as well. In addition, this post is focused on the interview rounds that were held in London, which may differ in other places where Amazon hires. The impression I received is that the interview process is fairly standardised across the various offices. So, here’s what I did on a regular basis until I finally landed this role. During this post I will describe the stage that I witnessed and comment on key points that I think will help you out if you end up in that particular stage. The stages I went through are:</p><ul><li>Online Application</li><li>Online Problem solving stage (+ behavioural)</li><li>The onsite stage</li></ul><p>So lets dive right in and experience what each of these stages is like. I will also cover some other</p><h3>Ahead of Applying</h3><p>Let’s say you are currently a student and are considering to apply for a full-time role at amazon. Or maybe you are currently a developer and you wish to apply in the foreseable future. Its a good idea to always be ready. The more practice you put in ahead of the application process, the more prepared you will be (which applies to almost anything in life). A <em>continuous growth</em> mindset is essential. I still practice algorithms and data structures everyday, since I consider myself an amateur — and I am interested in them. From a technical point of view the three key areas you need to focus on are <strong>Algorithms</strong>, <strong>Object Oriented Design</strong>, and <strong>System Design</strong> (focus on SOA, or microservices).</p><p>For Algorithms, there is no silver bullet and its all about how much practice you put into it and getting used to look at a code segment and analyse its time &amp; space complexity. There are alot of great resources to practice, and I will link some below.</p><h3>Getting Shortlisted</h3><p>Ironically, I think this could be one of the hardest parts of the process. The application process would be quite competitive as you would imagine. Amazon was the first tech giant to shortlist me for a next round after the Resume sifting stage — so I guess I must be doing something right, or maybe I just got lucky.</p><p>Of course you need to make sure your resume stands out from the rest of the applicants to stand a higher chance of getting shortlisted. Companies like Amazon receive <a href="https://www.youtube.com/watch?v=op67cZPiGwA">a lot of job applications</a>, and often they need to make a shortlisting decision <strong>within minutes</strong>. Make sure your resume is clear and concise, and try to make sure that the information most relevant to the role you are applying for appears first. Make sure to <em>read </em>the job role you are applying for and keep your features. Also take a look at some great sample CVs to gain some insights.</p><h3>The Online Interview Stage</h3><p>After I got shortlisted I was invited to the online round. The email I recieved explained everything about the platform used for assessment, and provided and mock test to familiarise with the environment. This stage consists of 2 algorithm questions with an allocated time of 90 minutes. After that you get 30 minutes to explain your code, and take a behavioural test. In my case I solved both of the problems using a brute force solution, which got them to pass the test cases. There were a few edge cases that were not documented in the question, and I had to guess what the expected outcome would have been for them. I’m not sure if they left it intentionally vague or they missed that part out from the problem statement. I completed both questions in 45 minutes so I had another 45 minutes to optimise my code. I attempted to reduce my N² complexity to N * log(n) using Binary Search. However, there was a bug in the code which I didn’t get to fix until after the time was out. So in the next part I explained how I would optimise my code further.</p><p>I was not sure if I would clear this round, since I only managed to use bruteforce. However, I was delighted to receive the email that I have cleared the round, and it was time to prepare for the onsite stage, which was a real beast on its own. Note that I can’t say much about the behavioural questions, other than the fact that I answered them as honestly as possible to express my behaviours in the respective situations.</p><p>Note: I have been told by colleagues that they managed to replace their online stage with a phone screening interview. This may or may not be possible and is not official, but it is worth asking your point of contact if you prefer speaking to a human and not have a machine judge your code :)</p><h3>The onsite Interview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RihnTj-HZj5icbex59u-JQ.png" /><figcaption>Selfie with Amazon Principal Palace building on interview day</figcaption></figure><p>Before the onsite interview, you are invited to attend a coaching webinar which discusses the expectations of the onsite stage. You are also invited to have a phonecall with one of the internal recruiters to go through any questions that you may have. This is a great chance to know what you would expect on the day. There were four stages for the onsite:</p><ul><li>Algorithms Question 1</li><li>Algorithms Question 2</li><li>Object Oriented Design</li><li>Systems Design</li></ul><p>Each of the above stages also consisted of a set of behavioural questions, based on the leadership principles, so let&#39;s talk about the behavioural questions first. I spent alot of time anticipating these questions in order to be able to answer them when asked. There is a Youtuber by the name of Dan Croitor who has done an amazing job in collecting expected questions related to these behavioural questions. Here is his most relevant video that helped me out: <a href="https://www.youtube.com/watch?v=RMA7tI-LTWY">the video</a>. I collected all of the 35 questions in a living document, and I prepared answer for each, based on my previous life experience. Below is an example of some answers I prepared for these questions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KbAdEVMXjlAuK1q1Yt5pA.png" /><figcaption>The scenarios I prepared to answer the behavioural questions based on Amazon leadership principles</figcaption></figure><p>Of course I did not memorise these answers, but writing this down helped me remember the cases once they were asked. The important part was to follow the Situation-Task-Action-Result (STAR) pattern, and to back up your claims with data or success metrics.</p><p>Now, for the algorithms section, there are plenty of resources to prepare for this, which I have linked to in the section below. My main strategy was to practice from a diverse range of problems to stay fresh for the day. A few problems for each category and data structure seemed like a good idea. So I picked a few problems from each category in the Geek4geeks course and used those for practice. One thing that came as a shock to me was that while writing the algorithms in the onsite stage I was not expected to run any code or test cases. You only type your code on an online editor and the interviewer examines your code visually, then asks you about some logical aspects, or edge cases.</p><p>Since I was applying for a role within Prime Video, I was expecting the system design question to be along the lines of designing a service like Youtube or Netflix. Therefore I prepared for exactly that. I found <a href="https://www.educative.io/collection/5668639101419520/5649050225344512">this course on educative.io</a> which provided a lot of sysdesign scenarios and then walked you through the thought process of designing the system components for it, covering various issues including database sharing, selecting NoSQL Vs. SQL databases, CDNs, etc. I studied the Youtube service quite closely and tried to understand all the factors in designing such a system. My expectation was right and I was in-fact asked a question related to this. If you prefer to not pay for an online course then there is also a github list of topics in <a href="https://github.com/donnemartin/system-design-primer">this repository</a>. However I found that this repository was too generic for my needs.</p><p>I did not do much practice for Object Oriented Design, since I felt like my time was better focused on the algorithms and System Design parts. Therefore I do not have much resources to recommend here. However, if you have worked as a software developer on mid-large software, or contributed to some open source projects, these patterns should be quite familiar to you. It is really a matter of understanding good design, maintaining your application state, delegating tasks for child objects via composition, and inheritance. Dealing with changing requirements is also one of the things that will be tested in this section of the interview.</p><h3>Offer or no Offer</h3><p>After some days you will get a call from your recruiter, which hopefully bears the good news.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9dhoAPsr4U23SE1TpMvfBg.png" /><figcaption>First email confirming the offer, following a phonecall</figcaption></figure><h3>Selecting the teams</h3><p>Once you get an offer, I was given a chance to select some teams which I would be interested in joining. After this I was able to speak to the respective team managers to learn more about the work they do. Based on this information I could select the team which I would be interested in joining.</p><h3>Preparation Resources</h3><ul><li><a href="https://www.educative.io/collection/5668639101419520/5649050225344512">Educative System design course</a> [paid]</li><li><a href="https://practice.geeksforgeeks.org/batch/must-do-1">geek4geeks interview questions list</a></li><li><a href="https://github.com/donnemartin/system-design-primer">System design premier</a></li><li><a href="https://www.hiredintech.com/classrooms/system-design/lesson/53">HiredInTech System Design tutorial</a></li><li><a href="https://docs.google.com/spreadsheets/d/1VGhAtykNLgV_t8r6bU3HJgHKz3B05S61gGtx5t5iXNc/edit?usp=sharing">Algorithms preparation sheet for interviews by Mustafa Saad</a></li><li>Book: Daily coding problem</li><li>Book: Cracking the code interview book</li></ul><h3>Further Information</h3><p>If you have any further questions or you think there is something I should missed on and should be added to the post, feel free to ping me on <a href="https://linkedin.com/in/mohamed-m-habib">linkedin</a> or <a href="https://twitter.com/_motatoes_">twitter</a> :) Also if you’re looking to improve in algorithms for the qualification or onsite stage, i run a <a href="https://www.meetup.com/London-Competitive-Programming/">regular meetup group for Londoners</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac213da724b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Competitive Programming LDN#3]]></title>
            <link>https://motatoes.medium.com/competitive-programming-ldn-3-ef3b01b80d20?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef3b01b80d20</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Tue, 15 Oct 2019 22:05:38 GMT</pubDate>
            <atom:updated>2019-10-17T08:27:56.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgWLPoaROzQ_LhtD6Kvn1A.jpeg" /></figure><p>We are <a href="https://www.meetup.com/London-Competitive-Programming/">Competitive Programming London</a>, we meet once a week to practice on some algorithm problems from Codeforces, Hackerrank, Leetcode and other problems. The general format for our meetings it to work on several problems in pairs and then discuss eachother’s solutions as a whole towards the end.</p><p>in this meetup we began to delve into Dynamic Programming problems.</p><blockquote>Dynamic programming (DP) is about finding some work (usually recursive) that would repeat multiple times unnecessarily, and so would be better to save these subproblems over time.</blockquote><p>DP problems are quite common in competitive contests. DP can often seem magical but with practice it starts to make some more sense. We started watching the <a href="https://www.youtube.com/watch?v=YBSt1jYwVfU">first video in Errichto’s series</a>, which consisted of a solid exponential. The following few paragraphs will summarise the video.</p><p>What kind of programs are DP problems applicable to?</p><ol><li>Combinatorics (count something, number of ways)</li><li>Minimize or maximize a value</li><li>Yes / No questions</li></ol><p>For 2 and 3, it is always a good idea if a greedy approach would work before jumping to DP.</p><p>There are 2 techniques to apply DP solutions to a given problem: <em>iterative</em> and <em>recursive. </em>Both of these are quite similar, but let us look at some differences:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAJfqF_inHawlEQ1YHriKw.png" /><figcaption>Differences between recursive and iterative DP, from<a href="https://www.youtube.com/watch?v=YBSt1jYwVfU"> Errichto’s video</a></figcaption></figure><p>Some of the top compeitive programmers including Errichto seem to prefer iterative DP solutions.</p><h3>Problems solved</h3><p>Here are the problems we solved during the session:</p><ul><li><a href="https://www.youtube.com/watch?v=YBSt1jYwVfU">Febanocci (from video)</a></li><li><a href="https://www.youtube.com/watch?v=YBSt1jYwVfU">Staircase problem (from video)</a></li><li><a href="https://www.youtube.com/watch?v=YBSt1jYwVfU">Staircase problem modified (from video)</a></li><li><a href="https://www.youtube.com/watch?v=YBSt1jYwVfU">Min grid path problem (from video)</a></li><li><a href="https://www.hackerearth.com/practice/algorithms/dynamic-programming/introduction-to-dynamic-programming-1/practice-problems/algorithm/intelligent-girl-1/description/">Intelligent Girl</a></li><li><a href="https://codeforces.com/contest/313/problem/B">Ilya and Queries</a></li></ul><p>We will continue with more advanced. DP problems next time.</p><p>If you are in London I hope to see you in the <a href="https://www.meetup.com/London-Competitive-Programming/">next event</a> :). Interested in joining our slack group to discuss problems like this? Drop me a line on <a href="http://twitter.com/_motaotes_">twitter</a> or <a href="http://linkedin.com/in/mohamed-m-habib">linkedin</a> to join</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef3b01b80d20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Competitive Programming LDN #2]]></title>
            <link>https://motatoes.medium.com/competitive-programming-ldn-2-5bedfb57da5c?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bedfb57da5c</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Wed, 09 Oct 2019 22:46:57 GMT</pubDate>
            <atom:updated>2019-10-09T22:46:57.450Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3fb9kNs8ix68tJKBfhVpw.jpeg" /></figure><p>We are <a href="https://www.meetup.com/London-Competitive-Programming/">Competitive Programming London</a>, we meet once a week to practice on some algorithm problems from Codeforces, Hackerrank, Leetcode and other problems. Everytime we meet we work on several problems in pairs and then discuss eachother’s solutions as a whole towards the end. For this event we had a go at three problems:</p><ul><li><a href="https://codeforces.com/contest/1228/problem/A">Codeforces distinct digits</a></li><li><a href="https://leetcode.com/problems/valid-parentheses/">Leetcode valid parenthesis</a></li><li><a href="https://www.hackerrank.com/challenges/drawing-book/problem">Hackerrank drawing book</a></li></ul><p>This post will summarise our discussion points and how we approached the solutions for each problem.</p><h3>Distinct Digits</h3><p>problem link:<a href="https://codeforces.com/contest/1228/problem/A"> https://codeforces.com/contest/1228/problem/A</a></p><p>This problem asks us to find a any number with distincts between the range a and b. The constraints of the problem are that both a and b is between 0 and 10⁵. Furthermore b is always larger than a. Like most competitive problems, its usually wise to see if a brute force solution would be enough for this problem. Our range is at most of size 10⁵, but if we were to check any range between a and b what is the most number of checks we have to make? Well lets find out with a quick script:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/517706d19ecf95e6eb3a5dbca41f8275/href">https://medium.com/media/517706d19ecf95e6eb3a5dbca41f8275/href</a></iframe><p>The program above will tell us how many calculations we can expect to perform in the *worst case* for the range between 0 and 10⁵. After we run it we get the following output:</p><pre>1047 10987 12034</pre><p>Which means the most calculations we will be performing are 1047, and that is for a=10987 and b=12034 . So this tells us that we can comfortably write a bruteforce solution to solve it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e85b64a47e7b33f7d30cb059b7eace56/href">https://medium.com/media/e85b64a47e7b33f7d30cb059b7eace56/href</a></iframe><p>Is there a more “efficient” way? It turns out there is, and its to as outselves if we can generate the minumum number greater than or equal to x which has distinct digits. I have pasted the code below which does this type of generation. It will take too long to explain what it does so if you have any questions about it reach out to me on social media (links below)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9318bbc3b43dabfaa52dc694a39ec0e/href">https://medium.com/media/f9318bbc3b43dabfaa52dc694a39ec0e/href</a></iframe><h3>Valid Parenthesis</h3><p>Problem link: <a href="https://leetcode.com/problems/valid-parentheses/">https://leetcode.com/problems/valid-parentheses/</a></p><p>As with most problems involving parenthesis, they can be solved using a stack. Every time you see an opening brace you push it to the stack. When you see a closing brace you pop the stack and check for a match. If one exists proceed. If the is no match or the stack is empty the sequence is invalid.</p><p>If we iterate through the string without issues, we just check in the end that the stack is empty. If it is, then our sequence was valid, otherwise if the stack was not empty then our sequence was invalid:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/170f7092a96bd0a0ba25c0528d15f851/href">https://medium.com/media/170f7092a96bd0a0ba25c0528d15f851/href</a></iframe><h3>Drawing Book</h3><p>Problem link: <a href="https://www.hackerrank.com/challenges/drawing-book/problem">https://www.hackerrank.com/challenges/drawing-book/problem</a></p><p>In this problem we just need to find which flip number we are in for a given page number. To do that, dividing by 2 (floored) will give us this value. for example for page 1, 1/2 = 0 , for page 2, 2/2 = 1 , for page 3, 3/2 = 1 , for page 4, 2/2 = 2 , and so on. So this gives us which flip index we are in. The key is then to calculate the flip index of the last page, and then our answer will be the minimum of the flip distance from the start (index 0) until the flip index of p , and the distance from the end until the flip index of p :</p><pre>def pageCount(n, p):<br>    fromStart = p // 2<br>    fromEnd = n // 2 - p // 2<br>    return (min(fromStart, fromEnd))</pre><p>If you are in London I hope to see you in the <a href="https://www.meetup.com/London-Competitive-Programming/">next event</a> :). Interested in joining our slack group to discuss problems like this? Drop me a line on <a href="http://twitter.com/_motaotes_">twitter</a> or <a href="http://linkedin.com/in/mohamed-m-habib">linkedin</a> to join</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bedfb57da5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why TADHack was my favourite Hack in 2018]]></title>
            <link>https://motatoes.medium.com/why-tadhack-was-my-favourite-hack-in-2018-f0dbce8e64a2?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0dbce8e64a2</guid>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[telecommunication]]></category>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Sat, 02 Mar 2019 10:57:31 GMT</pubDate>
            <atom:updated>2019-03-02T10:58:05.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*gAhXQ49uOto9V4s8WVUgoA.jpeg" /></figure><p>These days it is rare to find a hackathon where you can freely tinker around with your tools without worrying about a business case. With many corporates penetrating the scene, hackathons are become more and more like <a href="https://startupweekend.org/">startup weekends</a> in disguise.</p><p>The truth is, not every hack needs to have a purpose, and not every hack needs to turn into a startup. The beauty of hacking freely is that you don’t need to have a purpose behind your hack. Personally I find that this inclination towards developing “business models” over a weekend is restrictive to the freedom of <em>hacking away</em>, because:</p><h3>Hackers are not Entrepreneurs</h3><p>If we were to understand the original meaning of the term hacking we need to travel back in time to the late 1950s inside the trenches of the labs at MIT. The book <em>hackers</em> takes us on this journey back in time where the heroes of the book had never seen a computer in their lives, but were members of the Tech Model Rail Club (TMRC). These members spent most of their time tinkering and improving on railroad systems. The core members of the club were obsessed about improving the System to the extent that they developed a culture and a jargon of their own:</p><blockquote>When a piece of equipment wasn’t working, it was “losing”; when a piece of equipment was ruined, it was “munged” (Mash Until No Good); the two desks in the comer of the room were not called the office, but the “orifice”; one who insisted on studying for courses was a “tool”; garbage was called “cruft”; and a project undertaken or a product built not solely to fulfill some constructive goal, but with some wild pleasure taken in mere involvement, was called a “hack.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*Aoag5oMLpCzqY_c03qZOeQ.jpeg" /><figcaption>Hackers — heros of the computer revolution, profiles the hackers of the 1950s and the boundaries they pushed</figcaption></figure><p>No matter how hard I try I will not be able to describe this art better than this excerpt from <a href="https://hackaday.com/about/">hackady</a>:</p><blockquote>Hacking is an art form that uses something in a way in which it was not originally intended. This highly creative activity can be highly technical, simply clever, or both. Hackers bask in the glory of building it instead of buying it, repairing it rather than trashing it, and raiding their junk bins for new projects every time they can steal a few moments away.</blockquote><p>A hacker starts with a question such as <em>can I make X do Y </em>or <em>would I be able to repurpose this to do that?</em></p><p>On the other hand, an entrpreuner would start with an understanding of the market and segment it to understand his target user’s problems. Following that an s/he would develop feasible solutions to tackle this problem while keeping in mind a business model that allows his solution to generate appropriate revenue. While all of this is interesting it tends to distract one from the original hack in question. Many hack ideas would be disregarded along the way. They’re pointless from a business perspective but pleasurable from a hacking perspective.</p><h3>The TADHack experience</h3><p>So what is TADHack? According to their website:</p><blockquote>TADHack is a hackathon that helps people learn about the latest Internet, IT, and Telecoms technologies; and use those technologies to solve problems that matter.</blockquote><p>So it’s a hackathon related to anything telecommunications. I was skeptical about attending at first because I didn’t know much about telecoms and protocols. Eventually I decided that I have nothing better to do that weekend so why not just give it a shot.</p><p>I really wanted to get my hands dirty with some hardware for this one so I looked around my room to see what kind of tools I have available. Well I found a HackRF Software Defined Radio, A raspberry Pi kit — containing a bunch of drivers, displays and a breadboard, and an RC car. I always wanted to understand Radio Frequency (RF) so I decided why not decode the signal from my remote which controlled the car and see if I can regenerate this signal to control the car. Having watched <a href="https://www.youtube.com/watch?v=TZmHgIPBLDo&amp;list=PLVQhg1UYyzxUcv-bZnxOOA6pkoAB021d9">Michael Ossoman</a>’s series a while ago, this was my first practical project out of that tutorial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_DN7NH48SzZ2tTU1DgzakQ.jpeg" /><figcaption>The kit I had lying around</figcaption></figure><p>Initially I wanted to connect the hackRF to the raspberry pi and use it to decode and send the signals, but I ran into problems with that so I ended up using my laptop instead. I installed GNU Radio on my laptop and followed a tutorial to decode the signal. I found that the toy car operated at a frequency of 40MHz so I listened at that signal and captured the signal being transmitted from the remote. I inspected that signal in Audacity and discovered that it was an on-off keying signal that relied on a sequence of amplitudes to send a sequence of 0’s and 1&#39;s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNvIjiJNUPnQsJkWpturzQ.jpeg" /></figure><p>Next I decoded the signal in another flow graph and transmitted the digital signal to control the RC car. It took alot of attempts but eventually I got it to work. It worked for the forward button but I had trouble with the other 3 directions. Nevertheless it was exciting to see the wheels rotate as a result of my generated signal!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ukRUqKiOwWvh5nnh3Kawng.gif" /><figcaption>Success! The RC car wheels rotating forward using signals sent from the HackRF</figcaption></figure><p>I had plans to do other things based on that such as record the directions in a smart contract (fictional use case), but I couldn’t get it done due to time. While this hack was pointless for many outsiders, it was really fun to work on and I learned a lot about radio waves in the process. After I built it I made up a fictional usecase for it and <a href="https://www.youtube.com/watch?v=SYmukSSwf8A&amp;feature=youtu.be">pitched it on the final day</a>. And the runner-up award goes to …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kaiw-qhFKmrDzn9yB-fRdw.jpeg" /><figcaption>Apologies if I look rough here. <a href="https://www.youtube.com/watch?v=SYmukSSwf8A&amp;feature=youtu.be">Watch the pitch</a></figcaption></figure><p>While I ended up not using any of the APIs of the sponsors due to the lack of time, I explained what I was planning to do with Status.im and smart contracts if I did have enough time.</p><p>Overall it was a very positive experience and I enjoyed the fact that we were free to build anything we wanted that utilised the technologies of the event sponsors. I look forward to attending TADHack in 2019 and I think you should too. Find out if they organise one in a city near you or even join online global hackathon from the comfort of your home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GESyvP5iIicis_uUw2NROA.png" /><figcaption>TADhack 2019 dates and locations (website coming soon)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0dbce8e64a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Mobile App in Cordova]]></title>
            <link>https://motatoes.medium.com/building-a-mobile-app-in-cordova-487492a7d30e?source=rss-bb1569aa7ee4------2</link>
            <guid isPermaLink="false">https://medium.com/p/487492a7d30e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cordova]]></category>
            <dc:creator><![CDATA[Mohamed Habib]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 18:29:53 GMT</pubDate>
            <atom:updated>2018-01-02T18:29:53.917Z</atom:updated>
            <content:encoded><![CDATA[<h4>Things I wish I had known before building my first Cordova app</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYxadd2kS8r9PgPFamH1kg.png" /></figure><p>A Few months ago I had started building a Cordova application for a client. Cordova is a great project that allows web developers to use the existing technologies and tools that they are familiar with to build mobile apps. The initial reasons for the selecting of Cordova were:</p><ol><li>The client wanted to publish the app to both iOS and Android (as is usually the case)</li><li>I didn’t have experience with objective-c or building android apps (though I was familiar with Java). I also didn’t want to implement the app in objective-C and then go through the process of porting it to Java</li><li>I’m fairly comfortable with building single to medium sized web apps (VueJS + Vuex)</li><li>I didn’t own a Mac back then (not a valid reason as will be seen bellow)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*t7Npl1oM_DNnEr_ggKpLEg.gif" /><figcaption>Lashdesigner — The Cordova app I built. The initial goal was to detect the lash automatically and autoplace the selected lash design (like snapchat). Maybe this will be done eventually ;)</figcaption></figure><p>There’s alot of debate about “Native” Vs. “Hybrid” apps, which is better in terms of cost, performance and usability? You will often find different answers on StackOverflow, and in fact I think the answer to this question should be on a case-by-case basis depending on the budget, time constraints, developer experience and the requirements of the App. The stack I used was django for the backend REST API and VueJS on the frontend for the Cordova app.</p><p>As I proceeded with the project I discovered alot of things along the way which I thought to document here for anyone thinking about whether cordova or Phonegap is the right choice for their next project. Bellow are list of tips and gotchas that I learned while building mobile apps with Phonegap or Cordova. Before we go on, I would like to note that I will be using ‘Cordova’ and ‘Phonegap’ interchangeably bellow, since the phonegap CLI uses Cordova under the hood mostly. Phonegap seems to be a layer on top of Cordova that adds more features like a GUI to generate projects and other services such as Phonegap build. I initially started with the Phonegap CLI but later found out that I’m only using the console anyway and therefore went to using the cordova CLI. So without further ado, bellow are a list of things I learned while building a Cordova app for the first time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*DH05V50G_zdjp1gEFHez1Q.png" /><figcaption>The phonegap app used to load Cordova apps over the network.</figcaption></figure><h4>Don’t rely too much on the Phonegap app</h4><p>I was really excited to see that Phonegap has an application that can be used to run your app’s code directly over the network — eliminating the need for a long build step to test the app. However as I started testing some of the Cordova native APIs such as launching the device camera I couldn’t get it to work in the phonegap app (probably a permissions issue). Therefore I had to resort to testing in simulators and on device.</p><h4>Do yourself a favour and develop on a Mac</h4><p>One of the compelling reasons for my choice of Phonegap was that I (thought that I) wouldn’t need a Mac to the develop the application. I believed that it was possible to publish a signed app to the Apple Store using PhoneGap Build and then publish it directly to the AppStore. However, I later realised that I would need Xcode or Application Loader to publish, and they are only available on a Mac.</p><p>Another problem is that — as stated above — I found that the Phonegap developer app had many quirks that I needed to overcome. I started developing the app on a Windows box and testing the app on a browser (for the UI) and the Phonegap app. However, I found that alot of the plugins don’t seem to work. Often I wasn’t sure when a bug that I faced was due to a quirk in the Phonegap app or a problem with my code. Eventually I moved all my testing to an iOS simulator. For this purpose, I rented a remote Mac device on the cloud. Later I did myself a favour and purchased a Macbook pro since I realised that this was the most cost-effective option for my usecase. It’s possible to target both Android and iOS if you are developing on a Mac.</p><h4>Make use of remote device debuggers</h4><p>Web developers will really appreciate that they can use the web inspector console that they are familiar with to debug their apps. You can view Javascript errors and monitor network requests directly in the Web inspector window, which can make debugging problems a breeze. The only problem with this is that it lacks a “live-reload” like feature, aka I had to go through a change-build-test loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gQ_ihTNnccnMdniYM_64w.png" /><figcaption>An iPhone X simulator, an android emulator. Chrome is used to debug Android, and Safari is used to debug iOS.</figcaption></figure><h4>Ensure you’re allowed to accept payments in your app</h4><p>This is a more general comment and is not directly related to Cordova. I was personally bitten by this. After finally getting the app done and submitting it to the AppStore for review, it was rejected because the app was accepting PayPal/Stripe payments for <em>intangible </em>products. It turns out that there is a term in the <a href="https://developer.apple.com/app-store/review/guidelines/#payments">Apptsore Review Guidelines</a> that mentions this:</p><ul><li>If you want to unlock features or functionality within your app, (by way of example: subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use in-app purchase. Apps may use in-app purchase currencies to enable customers to “tip” digital content providers in the app. Apps and their metadata may not include buttons, external links, or other calls to action that direct customers to purchasing mechanisms other than in-app purchase.</li></ul><p>If I had known this earlier it would have spared me a week of integrating Stripe and Paypal payments and I would have jumped straight to integrating inApp purchases in the app. Perhaps the lesson here is to account for the iOS review process when estimating the time required. That’s what we discuss next.</p><h4>Take iOS reviewing time into account</h4><p>In my opinion you should take into account an extra week or two for the reviewal process. Although the review process takes on average 24 hours for apps submitted the first time, a rejection will usually require changes to be made and resubmitted, which is going to last sometime. Its important for your client to know about this extra needed time in order to avoid dissapointment. Thankfully, the Android review process works in reverse: Apps can be published to the PlayStore immediately and only apps that are flagged as inappropriate will get removed.</p><h4>iframes don’t work well in a WebView</h4><p>When I first attempted to integrate Paypal’s <a href="https://developers.braintreepayments.com/start/hello-client/ios/v4#present-drop-in-ui">Braintree SDK</a> using their drop-in UI. I thought it would work out of the box since Cordova is a web-view after-all right? However, I faced many issues with this approach. In the end I had to resort to a Cordova plugin. As far as I understand: for security reasons mobile webview components are limited in terms of the network requests that they make. And it seems that adding an iframe that attempts to form a network request gets blocked by the WebView. You can, however, make regular API calls with AJAX <a href="https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/">after you whitelist the specific domains.</a></p><h4>Signatures are tricky</h4><p>Especially if you’re doing it for the first time, preparing and signing the app to upload it for beta testing / release is tricky in both iOS and Android. There’s alot of information and details to grasp for this process. I attempted to use <a href="https://build.phonegap.com/">Phonegap build</a> in order to sign the app at first, but eventually I used XCode and Android Studio to sign for each platform. I believe Cordova has the ability to sign your apk or ipa from the command line but I found that XCode’s process is more smooth. The Cordova CLI calls xcode under the hood anyway. Although Its probably a better idea to rely on a CLI command to automate the build process down the line.</p><h4>Heroku will save your time</h4><p>Your app will probably need to communicate with a REST API server in order to provide functionalities such as login, registration and whatnot. For my particular app I had to integrate with Stripe, Paypal, provide authentication, and lock some features on a per-user basis. I wanted to have a simple Django app to expose a REST API for this purpose. However, I wanted to spend almost zero time managing/configuring a VPS or server since my focus was to be directed towards developing the app and the server components. Having worked with the amazing (barebones VPS) Digital Ocean in the past, I wanted a more care-free solution, and Heroku was the right choice. Using Heroku dynos helped uplift the server management work off my shoulders, and it comes with great addons for things like sending emails and DB access.</p><p>Building an app in Cordova turned out to require much larger effort than I had initially anticipated. There are alot of things that a mobile has to take into account which a web developer does not encounter. I hope you found some useful points in this post, and if you have some corrections or things to add, please feel free to add them bellow so I can add them to the list!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=487492a7d30e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>