Category: Python 3

  • 412. Fizz Buzz Python 3 Solution

    412. Fizz Buzz Python 3 Solution

    412. Fizz Buzz Python 3 Solution for LeetCode and HackerRank problems Requirements Input: integer n Output: string array answer (1-indexed) where: answer[i] == “FizzBuzz” when i is divisible by both 3 and 5. answer[i] == “Fizz” when i is divisible by 3. answer[i] == “Buzz” when i is divisible by 5. answer[i] == i for…

  • Automate Mouse Clicks on PC record and playback

    Automate Mouse Clicks on PC record and playback

    Automate Mouse Clicks on PC record and playback mouse actions. Automate mouse clicks using Python in Windows 10 and this simple script. Python is an increasingly popular programming language for quick tasks like this one. My Python programs are made of 2 parts. one that records mouse click events, that’s all that it does. The…

  • How to learn Python as a second language

    How to learn Python as a second language

    How to learn Python as a second language. After watching and reading few tutorials you still can’t say that you know much Python and that’s probably true. How I try to learn it, still work in progress, is to use a project-based approach. Learn the basics of the language. 1. No semicolons; 2. Indentation matters…

  • Random Password generator in Python

    Random Password generator in Python

    Random Password generator in Python How I wrote a random secure password generator in Python in 30 min. What I needed was a small script that I execute and generate a random password that is then copied to the clipboard and all I had to do was paste it Ctrl+V to use it. Every time…

  • 155. Min Stack

    155. Min Stack

    155. Min Stack Solution programming interview question. Design a stack that can return the minimum element in constant time and also support pus, pop and top methods. Example:Input[“MinStack”,”push: -3″,”push: 0″,”push: -5″,”getMin”,”pop”,”top”,”getMin”] OutputMinStack minStack = new MinStack();minStack.push(-3); // returns nullminStack.push(0); // returns nullminStack.push(-5); // returns nullminStack.getMin(); // return -5minStack.pop(); // returns nullminStack.top(); // return 0minStack.getMin(); //…

  • 20. Valid Parentheses Leetcode Solution

    20. Valid Parentheses Leetcode Solution

    Valid Parentheses Leetcode 20 Solution Return boolean indicating wether the pairs of paranthesis are matching and there are no un-matched paranthesis found. Using a list to implement a stack in Python.Store all the pairs of opening and closing tags in a dictionary. Closing brackets are the key.Go thru the characters of the string and add…

  • 66. Plus One LeetCode Solution in Python

    66. Plus One LeetCode Solution in Python

    Plus One LeetCode Solution in Python 3. Given a non empty array of decimal digits representing a non-begative integer.Increment the integer, most significant digit is on the left. Each element contains a single digit.No leading zeros except for the number 0. Examples Input: digits = [1,2,3] Output: [1,2,4] Input array represents the int 123 +…

  • Google Interview 686. Repeated String Match

    Google Interview 686. Repeated String Match

    Google Interview 686. Repeated String Match. Given two strings a and b, return the minimum number of times you should repeat string a so that string b becomes a subscring of sring a.If b cannot be a substring of a after repeating it, return -1. String “acb” repeated 0 times is “”, repeated 1 times…

  • Google 844. Backspace String Compare

    Google 844. Backspace String Compare

    Google Interview 844. Backspace String Compare Given two strings s and t, return True if they are equal. ‘#’ means backspace. Examples Input: s = “ab#c”, t = “ad#c” Output: true Explanation: Both s and t become “ac”. Input: s = “abb#c”, t = “ade#c” Output: false Explanation: s becomes “abc” and t becomes “adc”.…

  • Two Sum Solution [LeetCode 1]

    Two Sum Solution [LeetCode 1]

    Two Sum Solution in Python 3 [LeetCode 1] Given an array of integers nums and a target integer. Return the indexes (not values) of the 2 numbers that add up to the target value. One solution and one element can’t be used twice. Example nums = [1,2,8,7,11,15], target = 13 output= [1,4], indexes start at…