All Questions
95 questions
4
votes
3
answers
1k
views
Coding exercise to represent an integer as words using python
Context:
Convert a non-negative integer num to its English words representation.
Example 1:
Input: num = 123
Output: "One Hundred Twenty Three"
Example 2:
Input: num = 12345
Output: "...
2
votes
1
answer
662
views
Find all permutations of string using recursion
Background: I am somewhat new to programming and only two weeks into learning Python. Currently trying to improve my understanding of recursion, which has been a tough concept for me to implement.
...
0
votes
1
answer
187
views
Getting three numbers input interactively and process them
I'm new to Python and programming in general.
Let's imagine I have a simple task:
Given 3 numbers from user input, I need to count negative ones and print the result.
Considering what I know about ...
1
vote
2
answers
108
views
Object-Oriented Blackjack V2
[Edited] formatting and Flake8 linter corrections
Four days ago I posted my first object oriented programming project.
Everything I have learned to date is self-taught and posting project to receive ...
5
votes
2
answers
675
views
DNA Challenge from CS50
Added the problem link below and my implementation of it. Took me a few hours to program. I have added comments to explain my thought process.
Problem Link
Goal - To implement a program that ...
5
votes
2
answers
350
views
Chess Dictionary Validator from Automatic Boring Stuff with Python
This project is in chapter 5 introduced me to a whole new world of dictionary data structure. To put it briefly, I want to know whether the choice I took between lists, tuples, and dictionaries could'...
3
votes
2
answers
590
views
LeetCode 8: String to Integer (atoi)
I'm posting a solution for LeetCode's "String to Integer (atoi)". If you'd like to review, please do. Thank you!
Problem
Implement atoi which converts a string to an integer. The function ...
3
votes
1
answer
2k
views
LeetCode 1615: Maximal Network Rank
I'm posting a solution for LeetCode's "Maximal Network Rank". If you'd like to review, please do so. Thank you!
Problem
There is an infrastructure of n cities with some number of roads ...
3
votes
1
answer
46
views
Update UNIX-like system user profile picture with its GitHub account's one
Seeking to learning and have fun, I wrote out this script (what I expected to be) self explanatory and would appreciate some comments on that.
I published it as a gist and tried to do my best on what ...
5
votes
2
answers
228
views
Optimizing performance of randomly generated pygame maze game
I made a random maze generator that is also playable. The performance is crap and I'd like to improve it. I'll be working on this for a few more days to make it run better myself, but just thought I'd ...
2
votes
1
answer
184
views
LeetCode 839: Similar String Groups III
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you!
Problem
Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that ...
1
vote
1
answer
106
views
LeetCode 124: Binary Tree Maximum Path Sum 2
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Given a non-empty binary tree, find the maximum path sum.
For this problem, a path ...
5
votes
3
answers
1k
views
Find all numbers that are factors of one array and factor into the second array, then print their count
I'm working on a solution to the Following problem on Hackerrank, and I seem to have found a function that works for the purpose.
However, I feel as though this is a very overdesigned solution to a ...
1
vote
1
answer
472
views
LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers II
I'm posting my Python code for LeetCode's 1320. If you have time and would like to review, please do so.
Problem
You have a keyboard layout as shown above in the XY plane, where each English uppercase ...
3
votes
1
answer
417
views
LeetCode 146: LRU Cache II
I'm posting my code for a LeetCode problem. If you'd like to review, please do so.
Problem
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following ...