Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
250 views

Python Logic Gate Circuit Simulator [closed]

I have recently become interested in simulating logic circuits because of a electronics class at school. I have created a functioning simulator for logic gate circuits in Python. My implementation ...
turt1edman's user avatar
4 votes
2 answers
550 views

Geektrust coding challenge: simulating a marketplace for loans

This is the my solution to a coding challenge in Geektrust. The question is linked here. A shortened version would be as follows. The aim is to simulate a marketplace for banks to lend money to ...
SATW's user avatar
  • 43
3 votes
2 answers
735 views

MP3 Playlist Class in Python

Background Info I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
Seraph776's user avatar
  • 191
0 votes
1 answer
188 views

Advent of Code 2021 Day 4: Play Bingo against a Giant Squid

[This is my first post here - though I have been lurking in the back reading, plussing, and hopefully learning for over two years] Below is my solution for Advent of Code 2021 Day 4, where you are ...
Aganju's user avatar
  • 189
1 vote
1 answer
205 views

Rock paper scissors coding assignment

I had a coding assignment to write a Rock Paper Scissors game. The main task is not to show a solution but rather to test the coding style. The rules are such: Problem: rock is "O", paper is ...
Harton's user avatar
  • 33
2 votes
2 answers
107 views

OOP refactoring technique

I'm teaching myself Object Oriented Programming in JavaScript and I'm looking over this small P5 code of CodingTrain's No.78, which deals with flying particles in the canvas, as a material. The full ...
ten's user avatar
  • 121
8 votes
3 answers
2k views

A* (shortest path) with the ability to remove up to one wall

Problem You are given an HxW matrix. Each element is either 0 (passable space) or 1 (wall). Given that you can remove one wall, find the shortest path from [0,0] (start) to [width-1, height-1] (end). ...
Martin's user avatar
  • 183
4 votes
1 answer
2k views

Snake and ladder problem oops application

I am learning and trying to implement the best practice for snake and ladder game. Rules of the game The board will have 100 cells numbered from 1 to 100. The game will have a six sided dice numbered ...
Akanksha's user avatar
  • 129
3 votes
2 answers
5k views

Beginner - OOP Project - Airline reservation system

Hi I just finished a VERY Basic airline reservation system. Wanted some feedback please let me know what you all think, if I am obfuscating information or passing parameters where I shouldn't or if ...
K.Veerina's user avatar
4 votes
1 answer
330 views

LeetCode 284: Peeking Iterator

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 an Iterator class interface with methods: ...
Emma's user avatar
  • 3,542
3 votes
1 answer
461 views

How to design shopping cart Java application which satisfy modular, extensible and maintainable

I am new in Application Design. I have use-case as below As per the above story I have implemented code as below without any Modularity, Extensible and Maintainable. Could someone share the thoughts ...
Uday Kiran's user avatar
0 votes
1 answer
179 views

A python Hang Man Game [closed]

can anyone give me advice on how i can make my code more compact and efficient, and if you can, an implementation using OOP? Since, i just started learning Object Oriented Programming and it looks ...
Anonymous's user avatar
  • 1,224
3 votes
3 answers
786 views

An in memory Url Shortener in Java

This is a popular question in machine coding rounds. The requirements are to build a URL shortener. There are certain registered users who have the capability to define a URL and an optional time to ...
Suryasis Paul's user avatar
2 votes
0 answers
228 views

Codewars: Remote Control Virtual Keyboard

This is my solution to the Codewars problem TV Remote (symbols). Description In short, you are given a virtual keyboard with 3 modes between which can be switched by pressing the ...
Failware's user avatar
5 votes
3 answers
3k views

Mars Rover technical Challenge in OOP

I am trying to practice OOP and TDD concepts, I have written this code for Mars rover challenge from marsrovertechchallenge . Can you please review my code from my GitHub repository? Or you can ...
Sara Elmenshawy's user avatar
3 votes
2 answers
699 views

Banking application for Udemy Java course

I just "finished" a Udemy Java that involves building a banking application. Here is the problem definition: Scenario: You are a back-end developer and need to create an application to handle new ...
suky's user avatar
  • 31
9 votes
1 answer
952 views

Geektrust: Solve War problem in a OO way in Python

I solved this programming challenge whose objective is to come up with an OO solution to the problem. The problem statement is quite verbose and the tl;dr version would be: Given an enemy army(...
thebenman's user avatar
  • 1,158
7 votes
4 answers
1k views

Papers, Please - Kata from CodeWars - Python

This is possibly one of the longest katas I've finished so far. https://www.codewars.com/kata/59d582cafbdd0b7ef90000a0/train/python I've been working on this one for about an hour a day for about 2 ...
Christian Tanul's user avatar
0 votes
1 answer
380 views

Python program to find the substring with concatenation of all words

This is a Leetcode problem: You are given a string, S, and a list of words, L that are all of the same lengths. Find all starting indices of substring(s) in S that is a concatenation of each word ...
Justin's user avatar
  • 2,485
1 vote
1 answer
73 views

Simulating pod racing over a 2D map : am I implementing OOP in a GO-like fashion?

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be. I used an OOP design. Is it correctly implemented ...
Poutrathor's user avatar
5 votes
1 answer
352 views

Straightforward tax calculator OO design

Similar questions have been asked here before and my solution is pretty much in line with some of the answers. I wanted to work on this a bit. Scenario Basic sales tax is applicable at a rate ...
thebenman's user avatar
  • 1,158
2 votes
1 answer
1k views

Polymorphic DBConnector class exercise

GitHub GitHub if it's easier I'm in the process of doing a training course in C#. I've just gone over covering Polymorphic OOP / composition over inheritance etc... The latest exercise I completed ...
Webbarr's user avatar
  • 323
2 votes
1 answer
659 views

Stopwatch exercise from training course

Github Github for easy testing I'm currently undertaking a training course to try & further develop my skills in C#. The latest exercise was to create a basic stopwatch class that meets the ...
Webbarr's user avatar
  • 323
3 votes
1 answer
91 views

(Follow-up) Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)

Original code review: Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14) Source: HackerRank & ProjectEuler.net Problem: Largest Product in a Grid In the 20×...
Eric's user avatar
  • 261
2 votes
2 answers
148 views

Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)

Source: HackerRank & ProjectEuler.net Problem: Largest Product in a Grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. ...
Eric's user avatar
  • 261
4 votes
0 answers
105 views

Writing Go object code that respects Go guidelines

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be: Am I using the ...
Poutrathor's user avatar
0 votes
2 answers
164 views

A simple card game simulator

This is a homework question, and I have written the code but wasn't sure if I had picked the right data structure for this job and minimised time complexity. Can anyone give me some feedback, anything ...
Prashin Jeevaganth's user avatar
6 votes
2 answers
2k views

Predict mars robot position

Description A robot lands on Mars, which happens to be a cartesian grid; assuming that we hand the robot these instructions, such as LFFFRFFFRRFFF, where "L" is a "turn 90 degrees left", "R" is a "...
CodeYogi's user avatar
  • 5,127
6 votes
1 answer
4k views

Design an object oriented parking lot

I solved this system design interview question. The problem description Design a parking lot Constraints and assumptions What types of vehicles should we support? Motorcycle, ...
thebenman's user avatar
  • 1,158
4 votes
3 answers
86 views

Print the first, last, and in-between integers of a range

Given our spec from Code Golf: Given two integers, output the two integers, and then the range between them. The order of the range must be the same as the input. Examples: ...
Marco Tulio Avila Cerón's user avatar
1 vote
1 answer
419 views

Tic tac toe game using C++

I wrote this C++ code for Tic-tac-toe for an interview (The basic skeleton was pre-provided) and got rejected because the code was too complex and inefficient. I'm not an expert programmer so I'd like ...
Prasanth Suresh's user avatar
2 votes
2 answers
4k views

Designing a book library

Description: Design a book library which maintains the book inventory. The library should allow an user to favorite/un-favorite book. The library should allow an user to rent a book for a given ...
CodeYogi's user avatar
  • 5,127
0 votes
2 answers
182 views

Verifying if two numbers are equal using ArrayLists

I have some question about the code below. It works correctly, but: Is there a better/another way to solve the exercise (as an expert would have done:) or mine it's perfectly done? Also, I don't see ...
I likeThatMeow's user avatar
1 vote
1 answer
743 views

Count number of leaves in binary tree

Description: Given a binary tree find the number of leaves. Although the problem is simple and has been solved many times I am more interested in find object oriented ways to solve the algorithmic ...
CodeYogi's user avatar
  • 5,127
1 vote
0 answers
497 views

Fetching weather data from API

I was experimenting with some code to fetch the current weather data as well as getting the hourly forecast. I could have done ...
CodeYogi's user avatar
  • 5,127
10 votes
2 answers
22k views

Parking lot OO design

I have tried to design the parking lot problem. Here is the problem statement. Design a parking lot system where Admin can look up all the available spots for parking, He should be able to choose ...
Tiny Rick's user avatar
  • 339
13 votes
2 answers
772 views

A classy DNA nucleobase counter

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see Counting nucleobases in a nucleotide c. The repository with all my up-to-date solutions ...
Mast's user avatar
  • 13.5k
1 vote
2 answers
139 views

Print bounding box in the terminal

Right now I am finding ways to write better code in javascript and I see many coding styles used by different authors but right now I am thinking to write code which adheres to the object oriented ...
CodeYogi's user avatar
  • 5,127
5 votes
1 answer
5k views

Hackerrank: KnightL on a Chessboard

Problem statement KnightL is a chess piece that moves in an L shape. We define the possible moves of KnightL(a,b) as any movement from some position (x1, y1) to ...
Jianmin Chen's user avatar
  • 2,396
9 votes
2 answers
1k views

Create two vehicles, move them on a grid based on user input

I have a grid and a class Vehicle, which will have starting point(X, Y on the grid) and direction(one of N,E,S,W) taken from user and there will be commands, ...
Brandon Bishop's user avatar
4 votes
1 answer
137 views

Path Finder Maze

The goal of my code was to find all possible moves from each open position in the maze (@moves_hash), assign it a value for how many moves it would take to get to ...
kobetastic's user avatar
2 votes
0 answers
2k views

Leetcode 317: Shortest distance from all buildings

Problem statement: You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right. You are given a ...
Jianmin Chen's user avatar
  • 2,396
1 vote
2 answers
1k views

Sortable Shapes

Description: Although shapes can be very different by nature, they can be sorted by the size of their area. Create different shapes that can be part of a sortable list. The sort order is based on ...
Gringo Jaimes's user avatar
11 votes
1 answer
6k views

Find the shortest path through a maze with a twist: you can knock down one wall

I would like my solution to Google Foobar's prepare_the_bunnies_escape checked for readability, maintainability, extensibility, style, design. I am looking forward ...
josfervi's user avatar
  • 167
8 votes
2 answers
5k views

Hackerrank - value of friendship (II)

Problem statement You're researching friendships between groups \$n\$ of new college students where each student is distinctly numbered from \$1\$ to \$n\$. At the beginning of the semester, no ...
Jianmin Chen's user avatar
  • 2,396
2 votes
1 answer
601 views

Jesse and Cookies

Jesse loves cookies. He wants the sweetness of all his cookies to be greater than value K. To do this, Jesse repeatedly mixes two cookies with the least sweetness. ...
CodeYogi's user avatar
  • 5,127
1 vote
1 answer
2k views

Splitwise clone done right

I have started this project basically for learning perspective and wanted to learn good object oriented design. What I am trying to do is making clone of something like this but this is a command line ...
CodeYogi's user avatar
  • 5,127
1 vote
1 answer
3k views

Student Class in C++ using sstream for format

Based on my previous review, I'm posting another Hackerrank Class solution. Problem Statement We can store details related to a student in a class consisting of his age (int), first_name (...
Tolani's user avatar
  • 2,463
12 votes
2 answers
7k views

"Merchants Guide to Galaxy" challenge

I have solved the classic "Merchants Guide to Galaxy" problem: A merchant buys and sells items in the galaxy. Buying and selling over the galaxy requires you to convert numbers and units. The ...
rd22's user avatar
  • 171
0 votes
1 answer
1k views

Binary to decimal converter in JavaScript

This exercise with a test suite is from here. I did not intend to use ES6 features, it's plain old JavaScript. That's why I seek advice more on the good practices, performance side, than modern syntax....
Antonin Cezard's user avatar