All Questions
Tagged with programming-challenge object-oriented
75 questions
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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).
...
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 ...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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(...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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×...
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.
...
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 ...
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 ...
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 "...
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, ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 (...
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 ...
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....