instruction
stringlengths
71
95.1k
Recently I started looking and refreshing about algorithms and decided to try to do the 3 sum algorithm. I did the code below: public static int[] tripletSum(int[] A, int sum) { HashMap<Integer, Boolean> data = new HashMap<>(); for (int i = 0; i < A.length; i++) { data.put(A[i], true); } int...
I was wondering if anyone could make any suggestions to how I could write the following more concisely and reduce the number of IF statements? If possible, I would also like to simultaneously assign values to variables and calculate the score. I will eventually have multiple rule sets and formula scores for other quest...
Need to merge data per column if records in the first column are the same. I wrote a VBA code and it works but it works very slow as it executes "merge" function per each row no matter if consequent cells are the same or different. Sub DuplicateValues() 'Declare All Variables: Dim myCell As Range Dim myRow As Integer...
I wanted to implement a Timsort in python. Here's what I've come up with: from typing import List RUN = 32 def insertionSort(unsorted: List[int], left: int, right: int) -> None: """ Sorts the array using insertion sort """ for i in range(left + 1, right + 1): temp = unsorted[i] j = i-1 ...
At our company we use an SQLite Database to manage our Drawing IDs (CAD Drawings). The code is written in Python and I need to update it. I think the code I have has some problems, but I am quite unsure so I hope to get feedback and criticism from you all! 1. What my code does: It saves the ID, Title and Project Numbe...
C++17 have <charconv>. However this header does not work on MacOS - It compiles, but can not link. Same header is not present in MSVS. The header also missing from my Arm Linux, even my gcc compiler there supports C++17 as well. Following is a take to convert non terminated char array (e.g. buffer, string_view etc) int...
Here's how I'm using my location component: <LocationContainer opts={{timeout: 5000}}> {(address, error) => { if (error) { return <div>Could not determine address (why...? <span style={{color: 'red'}}>{error.message}</span>)</div> } else if (address) { return <div>{address....
I have made a class which is a thread-safe implementation supporting Deposit, Withdrawal, Check Balance Querying and Transferring of money. I have a class Account: public class Account { private int balance; private String address; private String userId; final ReentrantReadWriteLock lock = new Reentrant...
I am writing a program to compress an image using Huffman encoding and I need to write the data structure and the byte file. After that, I have to read/decode it. I realize that my read and write is very slow. I think in writetree() I need to write either width, height, compress bits and the tree data structure. I am n...
I have been working on Project Euler problem number 12. I have code that will get me the right answer, however it takes too long. I know the code works because I have tested it multiple times with numbers that are smaller and take much less time to iterate through. I first wrote essentially the same thing in python, bu...
I have a HashMap and I want to convert data in it to a Response object, but I do not find it clean and optimized. Is there a better way to achieve this? class Converter{ public static void main(String[] args) { Map<String, Long> map = new HashMap<String, Long>(); map.put("111", 80) // first map....
Writing game engine as a hobby, I've come across many situations where I need a container like a map, but searchable by different keys: a block allocator where a block needs to be searched by either offset or size, or resources searchable by either name or file. Having multiple maps for each of those keys is ugly and p...
I wrote a simple function that converts an array of words into proper case (using bitwise operations) and returns the array. I performed a simple test using std::chrono to check how fast it was able to perform the conversion. Using a vector of 1000 words the function was able to do it in an average of 27 microseconds. ...
The following code is of a quiz. Is there any way to generalize the code further? Example: If lifelines are used once, I've to a copy the code check the correct user each time. the same is for skipping. Is there any way to improve it? instructions = ''' Welcome to Py Quiz\n 1. Each Question C...
My first Elm program. Nineagram is a puzzle that appears in the local newspaper. Given the nine letters for the day, the task is to come up with two five-letter words that share the same middle letter. Example: efiimlrtu has at least one solution of... f e l i m i t u r This program is an aid to the so...
I've created a program for Banking System in C++14. You are given 9 options: Open Account Close Account Show All Accounts Deposit in Account Withdraw from Account Transfer to an Account Show Balance Show All Transactions Quit My program stores the deposits, and withdrawals, and transfers in a a file and uses them whe...
I would like to write a C++ code for the n-queens problem using the permutation approach. This means I index the queens from 1 to n, and the state of the checkerboard will be defined by an array where the i-th entry stores the row of the queen at the i-th column. Clearly, such array will contain a permutation of the se...
I started learning JavaFX a few days ago and I have just created as an exercise a simple Gem Puzzle game. The puzzle pieces can be moved if we click on them. The visual aspect of the game is very basic. The code is based on a MVC architecture. It's not totally finished. Still, before I get any further in this exercise ...
Question statement: A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1 Where 0.1(6) means 0.16...
I implemented a simple maze generator as practice and I wonder what can I do to improve my C++ skills. I saw this implementation and used it as an inspiration for some parts of my code link. I am a little bit confused about usage of the 'inline' keyword. Should the definition of an inline declared method be in .cpp fil...
This program I have written automates some of the more manual work in getting the results from my experiments. The idea is that I have folders and subdirectories in my main directory. Some of these subdirectories contain the data I need process. Inside each of these subdirectories that contain data, there are another f...
Here's what I could comprehend in C code: Generates a key using PBKDF2 Generates an IV which is MD5 of PBKDF2 key in step #1 Does AES-256 encryption on customer-id - which is one of the output RSA public encryption on PBKDF2 key which is the second output. Objective Need to send a request map to a third party with e...
I haven't written a linked list from scratch in a couple years, so I decided to take a stab at it again. After working on it on and off for a little over a week, I'm finally happy with it. It implements Sequence. Since it overrides each method, having it extend an ABC wasn't really necessary, but I thought that it woul...
I'm a newbie playing around with Fortran 90 and openmp and wrote the code below (a simple 2D heat transfer simulation) for testing purposes. So far I don't see any speedup by using openmp / parallel processing. In fact, it gets slower when I use more procs. I understand that the parallelization requires some extra over...
My goal here is to make data driven nested forms in React. I've created a function that points to a form configuration JSON, which can contain both components and references to other configuration files, with their own components. I'm splitting it to separate files to keep things DRY and to get an easier overview (hier...
Here’s my code, the traps are the slightly visible squares. The user controls a red square (with arrow keys) and cannot touch the walls or traps or else the game resets. Additionally, if the user touches the green line, the game ends. Code: <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>Maze Game</t...
I am a beginner Java programmer and am in need of someone to read over it and help me condense my repetitive coding. I wrote code for a Bingo game and feel like I repeat code too often. If anyone could help me with my over obsessive use of repetitive code it would be greatly appreciated package bingo; import javax.sw...
The problem is stated in Encrypt this!: Your message is a string containing space separated words. You need to encrypt each word in the message using the following rules: The first letter needs to be converted to its ASCII code. The second letter needs to be switched with the last letter Keepin' it simple: There ar...
I was presented with a coding challenge: Given two integer arrays (in this case, the two given arrays have the same length of 6). And a target of 24. Find two pairs of numbers from those 2 arrays whose sums are closest to the target. I kinda find it lengthy. How can I improve it? #include <iostream> void which_no(int...
How would I clean this code/shorten it (most of it is login) What the program does: Only authorized players are allowed to play. Input from user should be validated where possible. 5 rounds. Score cannot go below 0. 2 players roll 2 6-sided dice. Points rolled on each player's dice are added to their score. If total is...
This is the Haskell version of my recursive Fisher-Yates shuffle in JS. import System.Random pick :: Int -> [a] -> ([a],[a]) pick _ [] = ([],[]) pick 0 (x:xs) = ([x],xs) pick i (x:xs) = (,) <$> fst <*> ((x:) . snd) $ pick (i-1) xs shuffle :: [a] -> IO [a] shuffle = runner =<< length where runn...
I am a hobbyist programmer trying to learn modern C++. My son had an assignment in his C++ class to fill in some functions that populate draw the cave in the "hunt for the wumpus" game. When I viewed the instructors skeleton code I found it to be very C-like rather than C++-like. So, I decided to rewrite it so I could ...
Here's a password generator I created. ### THIS PROGRAM WAS CREATED FOR LEARNING PURPOSES ### ### AND SHOULD NOT BE USED TO CREATE PASSWORDS! ### import string from enum import Enum from random import randint, shuffle, choice class PasswordError(Exception): __module__ = Exception.__module__ # Types of chara...
I've been working on a personal project. There's this game called TFT which is an autochess game. Each match is played by 8 players and there's a shared pool of champions. Each champion has their cost and how many of each there are, below is the table: 12 Champs that cost 1 gold, 39 of each champ. 12 Champs that cost 2...
This is a simple Java application, which adds songs to a playlist, removes songs from playlist based on indexes. A database is not used in this. I am creating dummy data through a Utility class. I want to get feedback on design and code, so that I can refactor it. MusicApp main class, creates a random playlist. Adds/Re...
this is my code for watching IP packets. I am doing project for my self because I want to learn how this things works. This is my IP Packet class: public class IPPacket { private IPHeader _ipHeader; private TCPHeader _tcpHeader; private UDPHeader _udpHeader; public IPPacket(IPHeader ipHeader, TCPHeade...
The task Given an integer array, move all elements that are equal to 0 to the left while maintaining the order of other elements in the array. Let's look at the following integer array. After moving all zero elements to the left, the array should look like this. We need to maintain the order of non-zero elements...
I wrote a JSON parser for C++. It is not particularly fast, efficient or elegant. I'd like to change that and primarily I'd like the code to be more elegant. How do I improve it and get rid of all the code smell? Aside: I have never taken a computer science course in my life and I'm not sure how far this deviates from ...
The code below is a program I'm writing to help myself budget. I am still new to programming and was wondering what you all thought about the code, or what I could improve at and what is good. This works by gathering data and information from the income and bills to help show you your budget. My end goal with this is...
Each client application would send a filepath and search term to the server. The server then takes that file path reads the file and returns any lines that contain the search term, the server then watches the file for any size increase and if the new lines contain wanted information it gets transmitted. The first for l...
I have this code, and the point is I want to dynamically change the mongo connecter to change between ssl, not ssl and with and without username in the same connecter function. if auth_required: if config.getboolean(component, 'ssl', fallback=False): client = MongoClient( '{host}:{port}'.format(...
I am a beginner with regards to C; I'm used to using high-level languages (Java, Python, JS, etc) and this is my first project in a lower-level language. I wrote a simple Brainfuck interpreter, given that my Python implementation was super slow. Here's the code: #include <stdlib.h> #include <stdio.h> #include <stdbool....
Syntax Checker is a very common question of c++ programming using the data structure stack. However, this is the advanced level base on this question I found in a reference book. Here is the question: Base on the question checking the string parentheses balance, the output is to print “Success” if all the brackets [] {...
Project Euler 18 Project Euler 67 As problem 67 is harder, I'll go with that one: By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. ...
I made a minesweeper game in c# as a method of studying, and right now its fully operational. I tried to use inheritance, recursion, and other fundamentals as clean as possible. Also I tried to use commenting as much as possible as I see many people do not do this, and it makes the code all the more confusing, both for...
I'm currently modifying a research project (massive test and benchmark of diverse conjectures to try and eventually solve the SSW conjecture) so that it can run on a big HPC architecture, which does not handle most of the 'classic' multi-process/multi-thread methods (like fork-based in C, python multiprocessing module,...
Followed-up here. I've written a partial z80 emulator in C++. It has a decent part of the instructions that can be reused implemented but I've had some issues with duplicated code. I'd also like to note that this is my first C++ project; before that I've primarily dealt with C and Assembly. emulate.cpp: #include <std...
Given a class where the methods return this you can chain them. const e = new Example() e.add(1).add(1).add(1).add(1).add(1) However this breaks does not work if one of the methods is async and returns a promise. I created an alternative method on compose the class Meow2 below that adds this kind of functionality. con...
I was given this coding challenge when a applying for a summer internship but didn't get selected for the next round and I was curious if it could be improved. The problem says: Given a number in base "-2" divide it by 2. For example: Given [1, 0, 0, 1, 1, 1] (-23) the output is [1, 0, 1, 0, 1, 1] (-11) Given [0, 0, 1...
This is a HashMap implementation written in Python. All the methods are based on the java implementation of a HashMap. Any and all critique is welcome. This implementation is just a rewrite of some java HashMap methods. Yes, it's basically a wrapper class for pythons dict. This implementation is a simple exercise to se...
I am learning about GraphQL so I decided to make a schema for some sort of social network. Please let me know if there are any best practices I should follow based on my schema below. scalar DateTime type Query { # user currentUser: User # use request "Authorization" header to get credentials ge...
Please review my code. I would love to know what improvements I can make in terms of efficiency as well as readability. Thank you! using System; using System.Linq; public class Bojo { public static long NextBiggerNumber(long n) { //check if bigger number is even a possibility if (N...
I've made this module in Lua as a mod for Project Zomboid game. In future I will develop my mods in a small team (of 2-4 programmers). At this moment I have no experience in teamwork, because most of the time I was programming alone. My question is: 1) What are my main mistakes (in terms of code architecture)? 2) How t...
My code below creates a folder based on the passed data from my client-side(VueJs) and checks if there's already an existing folder and deletes it if there is otherwise it will create a new one. My problem here is that I think my code is too long and unreadable although it accomplishes the task that I want to happen. ...
I've created 2 helpers for std::regex. The first helper match fills the given std::vector<std::pair<std::string, std::size_t>> with the first match with all subgroup matches and their positions. match_all builds on match and sets the given std::vector<std::vector<std::pair<std::string, std::size_t>>> to all the matche...
Hey I'm trying to optimise particles.js library from Vincent Garrau in order to get 60fps @ 500 particles ~. I've already refactored the code to use a quad tree instead but it does not seem to be enough. In fact, I saw no improvement using the quad tree. Maybe I implemented it incorrectly ? What I'm doing ? Generatin...
I created this program originally for Project Euler 14. Here's the code: from sys import setrecursionlimit setrecursionlimit(10 ** 9) def memo(f): f.cache = {} def _f(*args): if args not in f.cache: f.cache[args] = f(*args) return f.cache[args] return _f @memo def collatz(n):...
I recently worked with some pickle files which had a really strange format where the keys are sometimes delimiter separated with colons and placed in the same depth but also mixed with ordinary key value pairs. This is a basic example of this mixed format: { "objects": { "list::1": { "attr1": "f...
In an angular application I would like to set the browser title to something that is helpful. (Helpful means that the user gets a meaningful history and can identify tabs easily). Setting the title should be as automatic as possible. That means: If the route changes and the component that becomes active has title, the...
I was practicing divide-two-integers question from leetcode Question: Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividing dividend by divisor. The integer division should truncate toward zero. Question Link: https://le...
I am creating a dialect of ActionScript 3.0 and now have a working verifier, or “symbol solving” verifier. The language upgrades ActionScript 3.0 with few operators, light syntax facilities, numeric enums and way more compile-time semantics. To test verifying, run: $ git clone https://github.com/shockscript/sxc $ cd sx...
I inherited this code and have to fix it. It does work and I know I can refactor the code using If Not Intersect(Target, Me.Range()) Is Nothing Then syntax. I am wondering if using a function to pass the cell references in this case would be best, but im not really familiar on working with functions yet and would lik...
Given a vector of maps: (def my-list [{:a 1 :b 2 :c 3} {:a 1 :b 5 :c 6} {:a 7 :b 8 :c 12} {:a 10 :b 11 :c 12}]) and a blacklist: (def blacklist [{:a 1 :c 3} {:a 10 :c 12}]) the expected output is: [{:a 1 :b 5 :c 6} {:a 7 :b 8 :c 12}] I came up with: (defn not-excluded? [blacklist item] (not...
Yes I know context managers are a much better way to do this, but I spent four hours working on implementing a switch construct using generic decorators, and I'd like to hear feedback on how I did. I'll do it with context managers tomorrow.   I don't think I qualify as a beginner anymore (I'm looking to start getting...
I have the following code for separating out overlapping rectangles vs. non-overlapping rectangles in C++ 11: #include <stdio.h> #include <opencv/cv.h> #include <opencv/highgui.h> #include <opencv/cxcore.h> #include <math.h> #include <array> int main() { auto detected = get_detected(); std::vector <Rect> singl...
I am working on a PHP MVC project for my portfolio. Its an web app where you can store contacts (email and phone number). I am having trouble with filtering contacts based on filter form that has 3 options https://ibb.co/8dJbSWd I wrote code that works fine but I am sure there is better way of doing this. Here is the c...
I'm learning racket and did simple code challenge in a literate programming style with org mode The problem: Given a matrix of integers and the top left and bottom right coordinates of a rectangular region within the matrix, find the sum of numbers falling inside the rectangle. 1 2 3 4 5 6 7 8 9 0 1 2 should give 24...
The code is doing everything that I need it to. It's taking much too long though upwards of a couple minutes to complete the macro. Does anyone know how I code optimize this VBA code to run quicker? I'm new to VBA and I'm not quite sure how to proceed. This code will be running on roughly 35,000 lines of data. Public S...
I need to be able to cancel a long running query programmatically through our application. The code below will kick off a long running query and give control back to the main thread. At any arbitrary time, a user could choose to cancel the query. It both cancels the Task as well as cancels the query in SQL Server. I...
I have a class method that is set up to make requests to an API and I'm having issues handling the possible errors that could arise by trying to communicate with that server. The idea is if an error were to pop up, then it would call on itself until either it no longer needs to (because it worked), or it reaches a limi...
I am learning Go by writing a simple CRUD REST API using gotilla/mux and Gorm. I would like to get some feedback on the application code and on unit tests in particular. Please suggest me what to improve, what to do better, what not to do and generally tell me what comes to your mind. func TestGetAllStudents(t *testin...
I've made a function that outputs the highest and lowest values from a string containing a space-separated list of numbers. For example, if given "123 956 334 421 -543", my function returns 123, -543. def high_and_low(numbers): m = [int(i) for i in numbers.split()] h = max(m) n = [int(i) for i in numbers...
I'm learning C++, data structures and algorithms and decided to implement some sorting algorithms using generic iterators instead of array indices. This post contains code for insertion sort and other three variants: insertion sort with binary search, insertion sort with interpolation search and shell sort. As implied...
I'm working on a (naïve) algorithm for portfolio optimization using GA. It takes a list of stocks, calculates its expected returns and the covariance between all of them and then it returns the portfolio weights that would produce the highest return of investment given a certain maximum risk the investor is willing to ...
Sorry if this has been answered to death—I'm working on a pig latin translator for Odin Project. The code below works fine for individual words, but when it receives two words ("eat pie"), the output is nil. Please let me know if I've left out any details. Thanks in advance for any suggestions. def translate(word) con...
The following is a solution to the knapsack problem and supposed to be my entry to this weeks perl challenge. I wonder if this is a good use of dynamic variables or is it too confusing? I use them so I don't have to put the variables $n, @things and @result in all the signatures of the multi-subs and carry them throu...
I am currently in between semesters at school and am using that time to improve on my knowledge of C++ classes by making a node class and a linked list class that inherits from the node class. There is a list of areas in need of improvement at the start of the code, but I was also hoping to get some external input on t...
The code below will scrape data from three APIs. The APIs are for property listings. So, for each listing, I will have one request. There will be around 20000 requests. That's why I use ayncio to make the request. However, I will be banned by their server if I request frequently. So, I use Tor and user-agent to get rid...
Here is an earlier attempt to solve the original problem: Solving Sierpinski Triangle in Haskell I was never satisfied with my solution and found it was awkward and twisty. Here is another attempt to solve the same problem using Data.Array and I found that by using mutable arrays the solution becomes much shorter and e...
I am creating back-end for a web-application in Play framework with Java, using Couchbase for storage. This class is saving and fetching User details from Couchbase. My questions are: Will my DAO implementation work for high volume traffic (thousands of users saving and fetching User details simultaneously)? If not, h...
This code is used to check opening hours data from OpenStreetMap can be handled by an editor app. In case where opening hours is not too complex data is also turned into an usable form. It is a part of a StreetComplete editor app. This specific file will be part of pull request that will add ability to resurvey opening...
I have implemented a Merge sort in Python 3, and it works well. If anything needs to be improved, I would appreciate the criticism. def merge_sort(nums): if len(nums) == 1: return middle_index = len(nums) // 2 left_half = nums[:middle_index] right_half = nums...
I wrote an algorithm that analyzes protein-RNA interactions and I found that the following function is the bottleneck that causes performance issues: import numpy as np #len(protein_sequence)~500, len(rna_sequence)~1500 def affinity_matrix(protein_sequence, rna_sequence): python_matrix = [[] for _ in range(len(p...
I have a class that creates an object, PlannedYear, and then passes that object into several other classes to manipulate it. The ultimate goal of the class is to manipulate and add items to this PlannedYear object. I have, however, ended up going down a rabbit hole whereby I am updating the same PlannedYear object in m...
Method 1: public void removeFirst() { if (first == null) throw new NoSuchElementException(); if (first == last) first = last = null; else { var second = first.next; first.next = null; first = second; } } Method 2: public void removeFirst() { if (first == null) throw new NoSu...
The following program is comprised of three files and is aimed to be used as a Debian-Apache-MySQL-PHP-HTTPS version-agnostic environment bootstrapper. It is aimed to be used on raw Debian systems (anything that doesn't come with the OS wasn't installed) and to establish web domain associated web applications. The prog...
This code works, but I don't know if there are better and especially safer ways to do this. For context: this is a Django view (Python) and I wanted to unify the deletion methods because there were many of them. def delete(request, class_name, object_ID): obj = get_object_or_404(eval(class_name), id=object_ID) ...
I have the following arrays which save the MAC-adresses of a lot of bluetooth beacons and their positions in a building: private static final String[][] MAC_ADDRESSES_A_BLUETOOTH = {{"B09122F5D126", "210.105"}, {"B09122F5F26B", "136.121"}, {"B09122F5F619", "181.172"}}; ... private static final String[][] MAC_ADDRESSES_...
Does anybody know how to find pair of adjacent prime numbers in two-dimensional array, quicker than this? I'm talking especially about this part which looks for adjacent numbers not about function finding prime numbers or anything else in the code. //looking for first prime number of pair for(w=0; w<5; w++) ...
When learning a new language, one of my first tasks I like to go through is writing a few different sorting algorithms in that language to help familiarize myself with the syntax and see if there are creative ways that algorithm can be conceived in the language. In Go, I wanted to use this as an opportunity to work wi...
I would like someone to review my code on find indices of 2 numbers in array that sums up to an number. Following is the code that I have tried and it works. The real issue in the code is I am doing Map.lookup twice. Is there a way to avoid it. Input [1,2,3,4,5] 5 Output [2,1] Input [1,2,3,4,5] 4 Output [2,0] Code ...
I want to make sure that I am writing the code correctly and fully understand what is needed. My biggest concern is what tags to use, (? * | etc.) The element stories 5.1. The element stories contains 0 or more story elements. The element story 6.1. The element story has an enumerated attribute updated that ca...
I'm looking for optimized code with faster execution time. This writes CSV to parquet with the max size of 64 MB chunks. we are trying to concatenate the csv file contents being written as an parquet file until the parquet file size reaches 64MB The loop would continue to run until reads all the csv files content bein...
This is my attempt to build a simple simulation of a direct mapped cache, I'm new to C and trying to learn some low level concepts. I had some difficulties with the design, because I'm used to program in a object-oriented style. #include <stdio.h> int create_mask(int num_of_bits, int pos) { return (1 << num_of_...
Apologies for the cryptic title, I don't quite know how to title this question. I'm asking here rather than StackOverflow since I've got a working query, I'm just wondering if it can be improved. Anyway, I've got three tables, administration, mapping and used_mappings. Administration holds details of individual financi...
A dataset consisting of N items. Each item is a pair of a word and a boolean denoting whether the given word is a spam word or not. There shouldn't be a word included in the training set that's marked both as spam and not-spam. For example item {"fck", 1}, and item {"fck, 0"} can't be present in the training set, becau...
I wrote code to upload multiple(2) files. 1.Check if this is image: mime/extension/getimagesize. 2.Remove execute file permissions from the file(chmod). Is this script secure? What can go wrong? Class photograph class Photograph extends DatabaseObject { protected static $table_name = "photographs"; protected s...
I am new to python and coding in general and I recently found HackerRank. I have been mostly doing easy problems until now. Today, I saw the problem "Queen's Attack II" (https://www.hackerrank.com/challenges/queens-attack-2/problem), wrote my code, and it didn't execute in time for some of the testcases. I optimized it...
Quincunx is that little game where you drop a ball or disk down rows of nails in a pyramid formation until they land in a slot. This was a project for my class, but it's already been submitted. I am just looking for personal feedback since the professor does not give much in-depth feedback on these assignments. The goa...
I have been trying to get a better handle on the operator<=>, so I wrote two different string wrappers. The Strong_String wrapper uses std::strong_ordering to allow the std::sort function to sort words like a dictionary sorts words (i.e. a capitalized word occurs before the lowercase word, but not before all lowercase ...