instruction
stringlengths
71
95.1k
HOW IT WORKS - When you update a field, all of the fields after it are cleared. (It must work this way to ensure the user fills it out in order. Also a field depends on the value in the previous field) Each child component has a useEffect which should reset the field if the parent tells it to do so, then tell the paren...
I have a class that exposes var_dump data in order to get better human readable layout. I have achieved this with a lot of preg_replace and a series of regular expressions that run one after another. They parse the result of the var_dump to have a more readable and highlighted output. I would like them to review and ve...
I have a lot of nested for loops is there a better way to organize this code? Also the way I add and remove enemies and lazers seems like a bad implementation. I set the index of the table to nil but then that index doesn't get reused when making more lazers/enemies. Main require "..libs.vector" require "..libs.utili...
I'm looking for help speeding up some code I'm tinkering with. The rest of the code, as well as my 'benchmark', can be found here. #ifndef LALLOC_H #define LALLOC_H #define PAGESIZE (1048576) #include <stdbool.h> #include <stdlib.h> #include <sys/mman.h> #include <errno.h> typedef struct bblk bblock; typedef bbloc...
I've been trying to make a C# version of my Java CSV Parser using C# specific idioms. Here is the full code: using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; namespace CSV { /// <inheritdoc /> public sealed class ParseExcepti...
I have written a method which will return the size 16 List every time. If the input List has size less than 16, the remaining list object will be filled with default values.  Is there any way to remove the if and for condition from the enrichAddress method?. @Component public class TestService{ public List<TestB> enri...
I have design a model for product apps. This is the first time I am trying to create a product's database schema and then model it in Django. My code handles the following: A product type can have multiple products and each product type can have certain attributes in common. Examples of product types can be clothing, ...
Is there a better way to transform some expression to AST using Boost.Spirit? I have built it, but I think it's messy and can be simplified a lot. Code is also available on Godbolt. #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix.hpp> namespace ast { struct unary_operator; struct bina...
I've been doing some research around how to best make use of the WebP images (with fallback) in React. Most solutions point to something similar to what I've written below. That means if I have a lot of images I have to export the same image twice in assets.js (both PNG and WebP), import twice and provide two Image pro...
My custom hook useTyper.js ended up as a bit of a mess and hard to read. It's mimicking a nested for-loop but using React.useRefs to hold on to the indexes between renders. The indexes are the current positions of the outer and inner loop, those often named i and j in traditional nested for loops. Here's a fancy code s...
The code below returns the smallest perfect square that can be added to a number n to result in a perfect square. It works perfectly fine but I need it to run faster. def solve n (1..n).each do |i| i = i**2 + n return i -= n if (Math.sqrt(i) % 1).zero? end -1 end p solve(13) #36 # because 36 is the smal...
I am developing a workflow to perform a variety of operations on raster dataset using rasterio. My previous workflow involved lots of I/O when performing such operations on raster files. I would like to change the workflow so to process raster data in-memory. I am using rasterio.MemoryFile() class to achieve that. Here...
I usually use c++ so it may not be best practice for c. This is a stack based toy vm and as a result it is very primitive, and it has no bitwise instructions 64k might be a bit overkill for a toy vm. coding is hard #include <stdio.h> #include "vm.h" int main() { Vm *vm = new_vm(); i32 buffer[] = { 0x00...
This is another class from my implementation of SQL in C#. It handles the execution of SQL statements, with the core method looking like this: void ExecuteStatements( ResultSet rs ) // Statement execution loop. { ResultSet = rs; NextStatement = 0; while ( NextStatement < Statements.Length ) Statements[ ...
This is the 2nd iteration of a code review. The 1st iteration (completed) is at Iter 1: Reusable, robust c++ std::hash<mpz_class> for GMP's big integer type 1. Goal My intention is to provide a fast hashing algorithm to hash GMP's big integer type mpz_class and mpz_t so I can use these types as keys for an unordered_ma...
Please ignore the comments in the code for the purpose of reviewing. I just require tips on using SOLID principles and how classes can be used in this code.Comments in the code are for mapping the image in my brain to what I want to do in words. Sorry for the mistakes in the comments of the code. I wrote them really fa...
I built this code as part of a test project that was given to me by a company. They had given me a .csv file that contained over 9000 records and wanted me to build a program that would upload it to Firebase. Firebase has limits on how much data can be uploaded at one time, so uploading a large .json file would not hav...
I am displaying the data from a json file onto a website, with recursive and iterative tables side by side. i have the iterative code working, but I have no idea on how to make it recursive. Here is the code: $dataArray = json_decode($data, true); if(is_array($dataArray)){ //first level ...
I wrote this code where division can be done without using C's builtin operator: #include <stdio.h> #include <math.h> int idiv(int a, int b) { return a * (pow(b, -1)); } int main(void) { /* 15/3 is 5 */ printf("%d\n", idiv(15, 3)); return 0; } Is there anything I could do to make this code faster? I...
Introduction As a programming exercise I recently wrote this automatic differentiation library based on forward accumulation. It should offer a simple way to create mathematical functions whose directional derivatives can be computed. For example: #include <iostream> #include "autodiff.h" int main() { mx::Var x,...
I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem There is a box protected by a password. The password is a sequence of n digits where each digit can be one of the first k digits 0, 1, ..., k-1. While entering a password, the last n di...
I am creating a Python 3.8 script that executes a series of tests that reads and writes information to and from a CAN bus network. I'm using the python-can and the cantools packages. I've managed to transmit and receive data with small functions individually without issue. I feel I'm not creating the proper "Pythonic" ...
For my project, I've written a naive C implementation of Direct3D convolution with periodic padding on the input. Unfortunately, since I'm new to C, the performance isn't so good. By convention, all the matrices (image, kernel, result) are stored in column-major fashion. This is why I loop through them in such way so t...
from bs4 import BeautifulSoup import requests import re import datetime metal_translation = {"Aluminium": "Aluminio", "Copper": "Cobre", "Zinc": "Zinc", "Nickel": "Níquel", "Lead": "Plomo", "Tin": "Estaño", "Aluminium Alloy": "Aleación de Aluminio", "Cobalt": "Cobalto", "Gold*": "Oro*", "Silver*":...
Question: was using get_dummies a good choice for converting categorical strings? I used get_dummies to convert categorical variables into dummy / indicator variables for a cold start recommender system. It's only using category type information and some basic limited choices. The code works and the output seems good. ...
from bs4 import BeautifulSoup import requests import re import datetime metal_translation = {"Aluminium": "Aluminio", "Copper": "Cobre", "Zinc": "Zinc", "Nickel": "Níquel", "Lead": "Plomo", "Tin": "Estaño", "Aluminium Alloy": "Aleación de Aluminio", "Cobalt": "Cobalto", "Gold*": "Oro*", "Silver*":...
I am solving the "Sort" problem on Kattis. Mirko is a great code breaker. He knows any cipher in the world can be broken by frequency analysis. He has completely the wrong idea what frequency analysis is, however. He intercepted an enemy message. The message consists of N numbers, smaller than or equal to C. Mirko bel...
Continuing with algorithms I've implemented a binary search tree validator. I don't like the two boolean variables within NodeFollowsBSTContract as it feels too complicated. I feel like it should be cleaned up but don't see how, yet. Also, before each recursive step down, to check child nodes, a new list is created. Is...
Goal Return a deep copy of a double LinkedList. Each node also contains an additional random pointer, potentially to any node or null. Code to start data class Node<T>( var data: T?, var previous: Node<T>? = null, var next: Node<T>? = null, var random: Node<T>? = null class LinkedList { // TODO: ...
Here is my source code for my very first app in Java. I am completely new to the language; any help and criticism is welcomed! package com.company; import java.util.*; public class Main { public static float multiply(float a, float b) { return a*b; } public static float divide(float a, float...
I have a CSV like the following. Category,Position,Name,Time,Team,avg_power,20minWKG,Male?,20minpower A,1,Tom Smith ,00:41:58.95,7605,295,4.4,1,299.2 A,2,James Johnson,00:41:58.99,2740,281,4.5,1,283.95 A,3,Tom Lamb,00:41:59.25,1634,311,4.2,1,315 B,1,Elliot Farmer,00:45:06.23,7562,306,3.9,1,312 B,2,Matt Jones,00:45:10.1...
I tried printing the first pair of prime number in between a list of numbers with a particular difference. But my run time is still too high (for large range of numbers). I want to reduce the run time by using any method from standard library like itertools. def prime(x): """To generate prime number""" a = x //...
Please review my C++ CSV parsing class. I have some specific questions: Should get_next_record be a static function? CsvParser implies values will be separated by commas so is a field separator constructor over the top? record.clear() at the beginning of get_next_record. Any other ways of solving the problem of remov...
I am using a dictionary to save possible trajectories in a game. A trajectory is defined as a list of numbers separated by _. For example '3_7_2_5' is a trajectory of 4 steps. I use a dictionary as I assign a value to each trajectory. The meaning of this value does not matter for the purpose of my question. I also save...
I want to preface this by saying I didn't quite know where to put this because this isn't quite a stack overflow question. So if this is the wrong place to post, please let me know, and please let me know where I could post this type of question. I recently wrote a program with various functions doing a different thing...
I have written this code for depth first tree traversals. It feels like a lot of boilerplate, and I want to refactor it to remove this boilerplate. However I haven't done a lot of refactoring before, and I don't really know where to start. The code mostly consists of: Three interfaces Node, which defines two methods ...
I'd like to know if this code is usable, because I'm not sure, thank you. The code is used to upload images to a predefined folder for users. if(isset($_FILES['avatar']) AND !empty($_FILES['avatar']['name'])) { $tailleMax = 6844685465456456; $extensionsValides = array('jpg', 'jpeg', 'gif', 'png'); if($_FILES['avatar']...
I have updated my my gene sequencing program from my previous post. That post explains what each functions accomplish. If you need clarifications feel free to ask. Any tips to make the code more concise or efficient are much appreciated. Are there any functions that you think would be useful? Here are example FASTA and...
I've put together my first table using Qt's QTableView and a custom data model. Currently, some data is populated on initialisation, and the user has the option of adding and deleting entries. #include "mainwindow.h" #include "ui_mainwindow.h" #include <iostream> using namespace std; QList<Contact> contacts; MainWindo...
I have this C# method which get the character and its count which has highest occurrence public KeyValuePair<char, int> CountCharMax_Dictionary_LINQ(string s) { char[] chars = s.ToCharArray(); var result = chars.GroupBy(x => x) .OrderByDescending(x => x.Count()) .ToDicti...
This is a follow-up question to my previous question I have modified the code according to the feedback I got from here and my Professor. However, my Professor is still not happy with the final code. More specifically he is not a fan searching once to see if the item exists in the table and searching for the second tim...
I would like to reduce the following Python code. I have one list and a few if statements. a=[one, two, three, four] if a[0] in b: print(a[1]) if a[1] in b: print(a[2]) if a[2] in b: print(a[3]) if a[3] in b: print(a[0]) How can I reduce this to two lines of code and still to run in sequence? It w...
I have 2 scripts, one is a tkinter GUI script where the user gives specific inputs, the 2nd script takes those inputs, does some modification, and then sends it back to the GUI script to be written/results printed. However, in dealing with multiple user inputs, the entries for the functions started getting longer and l...
I'm still a relative beginner to coding and I would like some feedback on my Minesweeper clone written in Python using Pygame for the graphics. I'm wondering if it would be beneficial to use classes anywhere, or if there's simply a better way of doing what I'm trying to do. Thank you very much—any help is much apprecia...
I am a beginner, and so I have decided to program a Roman Numeral to Arabic integer converter. I came up with all of the code on my own. There are differing opinions about what constitutes 'proper' Roman Numerals. For example, 'IIII' is odd but known to exist in ancient writings, and 'VIIV' is a silly but parsable way ...
I am working on classification problem, My input data is labels and output expected data is labels Labels Count 1 94481 0 65181 2 60448 I have made X, Y pairs by shifting the X and Y is changed to the categorical value create X/y pairs df1 = df['Data_Used'] df1 = concat([df1, df1.shift(1)], axis=1) df1...
Just finished an exercise in the Rust online book and I wanted to know if there is anything worth talking about in the code I wrote... if there's any mistake or optimization possible. Convert strings to pig latin The first consonant of each word is moved to the end of the word and “ay” is added, so “first” becomes “ir...
I was looking over some code that I wrote years ago (that is still technically working, albeit on a very quiet production server) and I came across this segment of code. if(isset($array2)){ foreach($array2 as $key => $value) { if((isset($value['coord'])||isset($value['bookedbefore']))...
I made my first website from scratch using HTML and CSS. It's a doughnut shop I did this as a way to practice what I have learned so far from an HTML and CSS course that I am taking. I would appreciate anyone's feedback on this. I am fairly new to coding and your feedback will help continue learning and improving in th...
Hello am a new to Python and my programming concept is catching up to me. I just created my first ever project. I did not look else where for an answer, and it took me 6 hours to write. How can I improve this code? Is their a way to use for loop to check the if player1 beats player2. Please don't recomend using functio...
I have implemented a Tic-Tac-Toe game in C which can be played as two-player or with a computer player. #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <ctype.h> #define NPLY 10 /* board is represented using two bitfields */ const int wins[] = { 0007, 0070, 0700, 0111, 0222,...
I'm trying to find a way to know if a number on a matrix is positive, negative or zero. Below is my code, but I'm wondering if there is a more Pythonic way to write that. Any ideas? array = np.random.randint(-10,10, size=(10,10)) def function(array): case1 = np.where(array < 0, -1, array) case2 = np.where(case...
So I'm working through a beginners C++ book and they had this example demonstrating class hierarchy, which was originally in a single file. I tried recreating it with multiple files (header files + source files) to test my understanding, but I wanted to make sure that I did everything in the "optimal" way. Specifically...
How can I optimise this code there is time out error Program Challenge: HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the amount spent by a client on a particular day is greater than or equal to double the client's median spending for a trailing number ...
I had trouble solving instances of Exact Three Cover with 100 units in input C. All in a reasonable amount of time. Mainly because the problem is NP-complete. So I came up with an approximate solution (Don't ask me the ratio for correctness, because I don't know) I have gotten 100, 500 and 1000 units in C to return co...
I just finished solving Project Euler's 50th problem, but it's awfully slow. I'd like to hear your thoughts on my code's efficiency and practices. Problem Statement The prime 41, can be written as the sum of six consecutive primes: \$41 = 2 + 3 + 5 + 7 + 11 + 13\$ This is the longest sum of consecutive primes that adds...
I have made a program that converts Celsius to Fahrenheit and Fahrenheit to Celsius. How is my code? import java.util.Scanner; public class TemperatureConversion { public static void main(String[] args) { double fahrenheit, celsius; Scanner input = new Scanner(System.in); // Celsius to Fahr...
For my students (I am an Austrian math teacher) I would like to provide some simple online calculators on my blog. Let's say there are two pages on my website("Circle" and "Cube") and on every page I want to have about 10 different calculators. Here is an example of one page with two calculators: My code JSFiddle HTML...
I am new to C programming, I previously studied Python. Below is my year one project in C. My project's name is "Advanced Calculator", it's a menu-driven calculator application with several operations, as you can see from the first menu: Which mode do you want to use? [1] Normal maths operations [2] Special Functions [...
I'm currently familiarizing myself with reinforcement learning (RL). For convenience, instead of manually entering coordinates in the terminal, I created a very simple UI for testing trained agents and play games against them. You can experiment and play around with it using different hyperparameters but as this is a v...
To try and practice OOP, I've heard making a blackjack game can be really helpful; which it has been. I don't know how 'advanced' an implementation this is; but it has all the standard features, like being able to split/double. as well as actual card representations displayed in the terminal (made from ASCII characters...
I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. query(letter): returns true if and only if for some k >= 1,...
I wrote a function to check if a nested object contains the key-value pair matched as parameter as following. eq: const obj ={ "a":{ "b":{ "c1":["1","2"], "c2":"3" }, "b2":"values", "b3": {"c5": "v"}, }, "a2":["v1","v2"], "a3":"v1" } checkNestedObjectByKeyValue(obj,...
I built the Set Matrix Zeroes algorithm in JavaScript. I have a lot of loops in my code, so was wondering if there is a better way to implement this algorithm. Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. I loop through the matrix and when I find a 0, I set its entire ro...
I found out that I can increase the value of a variable inside an if statement like so: int limit = 100; int nrCopies = 2; int maxValue = 100; for(int i = 0; i < limit; ++i) { if((nTotal += (nrCopies)) > maxValue) break; } This works, and I became acostumed to do this, but I want to know if it is a good pr...
I am using LMFIT to fit the transfer function of a large impedance network to measured data, this involves some ~20 parameters and ~40 lines of (naively implemented) computations. there are a lot of computations that go into computing this transfer function, and many of those do not need to be repeated if the parameter...
This script was previously reviewed here: Send HTTP request for each row in Excel table (Part 1) I've made the changes that were suggested in the Code Review answers as well as added a few of my own. The code is quite a bit different now. Are there any more improvements that should be made? Description: A custom fun...
I started studying programming in January of this year and found a free online course that teaches Ruby. Below is my solution to the Eight Queens problem. I wanted my solution to be able to return any valid n-queens puzzle solution in a non-specific order. I'm looking for feedback such as: On the continuum of good or ...
A few days ago I made a "Rock Paper Scissors" game in C# and got my code reviewed on this site. Someone suggested writing a "Rock Paper Scissors Lizard Spock" game and I did. I tried to follow the given advices but I'm not sure if this code is better or way worse than the other. I am not satisfied with my code and woul...
I am trying to convert a BLOB that is stored in a database to a JPG and then I need to display it on an html form in a C# application. A little backstory first - this is an older web app that was designed to take a JPG (photo) that was stored as a path in the database, resize it, then show as a BLOB. This functionality...
I'm learning TypeScript while doing my portfolio, and I wrote a class to make a fetch request to the API that holds my data. It is working fine. I use localStorage to set a cache to avoid calling the API often as the data won't change. I know I could improve this a lot, and haven't used many TypeScript features, so it ...
A protein is composed of amino acids (also called residues). The amide nitrogen and hydrogens (N and H in the script), carbonyl carbon (C), alpha carbon (Ca), beta carbon (Cb), and alpha hydrogen (HA) form the backbone. Each amino acid has the N,H,C,CA,HA atoms, with most amino acids containing the Cb as well. Each ami...
I am a beginner programmer and I would like to improve in coding and develop my skills. That is why I am asking this question, what should I focus on improving in this code ? import random import re # this is the file that contains all the words from words import words # the word that the user needs to guess the_gues...
I've started learning bash today, but I knew basics of javascript. It would be very nice if anyone can point me at least a few advices on the code. Because there are so many details in bash, I hope you won't be too harsh. Expected behavior The code is supposed: to set the value of a variable named 'charge' from the in...
The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, such as: x11vnc-push-xwindow --id=none raspberrypi The Readme file contains more detailed instructions for setup, but the TLDR is... Clone mkdir -vp ~/git/hub/rpi-curio...
I am making a fractions calculator that can calculate fractions, whole numbers and mixed fractions. So there is a String fraction, which is the input. Also, the user will enter the fraction in a specified format which is: For normal fraction, "a/b" (a and b are integers) For whole numbers, "c" (c is an integer) For mi...
I implemented the boardgame Hex using the OpenAI gym framework with the aim of building a bot/AI player that can learn through self-play and expert iteration (details Note: not my paper; I am merely reproducing it). The initial agent uses Monte-Carlo tree search (MCTS), and I will compare myself against it to evaluate ...
I'm learning to use HSpec and QuickCheck. As example I was implementing the Pseudocode from Wikipedia:Extended Euclidean Algorithm. You can find the project at github for the implementation of the tested code. In particular I wonder about two practices: selection of test cases - I took two trivial samples, examples f...
I wrote the following Forth code for sorting a string with the Bubble Sort method. It looks nice to my eyes, but I'd like your experienced opinion and any comments about the code you might have. In the compare-and-swap-next word, is using the return stack to save base address of string ok? the bubblesort word uses 2 p...
Problem When it comes to security I like to don a tin foil hat. As such I use the, off-line password manager, Keepass. Keepass allows you to to use multi-factor authentication via; a password, a keyfile and the Windows user account. I enabled only two of these, the password and the keyfile. Because I have two computers...
Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways this.testCenterAccomodations.forEach((x: { utilityCode: string; isChecked: boolean; isSelected: boolean; }) => { if (x.utilityCode === 'PSDQRA') { if (this.voice...
I have written the following code to practice parallelizing a PyTorch code on GPUs: import math import torch import pickle import time import numpy as np import torch.optim as optim from torch import nn print('device_count()', torch.cuda.device_count()) for i in range(torch.cuda.device_count()): print('get_devic...
This is a follow-up to my original post of Blackjack with card representation visuals I was given some very helpful advice by @Reinderien and @Linny which I greatly appreciate. I have done my best to implement the changes. However, I am unsure if I actually implemented these changes in the best way, and would love if a...
Out of the majority of my c++ projects, the most used thing is std::vector because it allows me to not have to my own memory management. However previously I had never really thought much about how std::vector works internally. Until recently and that's when I decided that to better understand std::vector I should atte...
File fibonacci.aec: syntax GAS ;We are, of course, targeting GNU Assembler here, rather than FlatAssembler, to be compatible with GCC. verboseMode on ;Tells ArithmeticExpressionCompiler to output more comments into the assembly code it produces (fibonacci.s). AsmStart .global fibonacci #We need to tell the linker t...
In the interview you are asked to build a tower in a variable input e.g. n=3 . The output should be as show below. [ ' * ', ' *** ', '*****' ] My solution is the following. Is this a good enough answer for the problem because I know people can solve it using Linq with less lines of code. public string[] ...
I have a pandas dataframe, df1: a b c d e f 1 1 1 x 1 5 1 1 1 x 1 6 1 1 1 y 1 5 1 1 1 y 1 7 and another dataframe, df2: a b c d e f 1 1 1 x 1 5 Now I want to filter df1 on columns a, b, c, d if it is present in respective columns of df2. This is what I tried: mask = df1['a'].isin(df2['a']) & df1['b'].isin(df2['b']) &...
I am trying to figure out whether the below is better than just having a raw script or just a script with functions. class WebsiteImages(object): def __init__(self,photographer,Website_url): self.photographer = photographer self.Website_url = Website_url def GetNumberOfResultPages(...
Another graph algorithm, this time to create a priority or build order. Provided with a starting List<Project> and List<ProjectWithPrerequisite> the algorithm will return the order to build them in. For a list of projects a, b, c, d, e, f and their corresponding prerequisites where a, d means that a is a prerequisite f...
I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them. Two trees are duplicate if they have the...
I made a program in Java that asks for the student's name, course, and grades. After the required text inputs are filled, the program will then show the result. If the student passed, the program will show "PASSED"; if the student is failing, the program will show "ACADEMIC WARNING"; if the student failed, the program ...
I'm using Telegram API and I've different methods which returns different type of information like this: public SendMessage getTextMessage(Long chatId, String text) { return new SendMessage() .enableMarkdown(false) .setChatId(chatId) .setText(text); } public ...
Update: This is an older version of the question/script. The new version can be found here: Part 2: Create or update record via HTTP request I have an external system that sends an HTTP request to a Jython script (in IBM's Maximo Asset Management platform). The Jython 2.7.0 script does this: Accepts an HTTP request: ...
I am currently working on a project and very recently came across Vuejs. I used it to create a dynamic form on my frontend, however, the approach I took does not seem right to me. Could someone take a look and provide some feedback? var app = new Vue({ el: '.directionsContainer', data: { directions: [ ...
Follow up to my question here: Constexpr circular queue . I've taken the time to fix the many problems pointed out there and am asking for any tips/corrections for the new version below. The queue will work with non-trivial types in non-constexpr contexts. For types that are trivially copy assignable and destructible, ...
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 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizonta...
I'm currently writing a small game in Lua, using the Love2d framework. I guess I'm doing it as a practice of sorts, but it did give me the opportunity to write my first pathfinding algorithm. I wrote it based off of a 10 minute Youtube video I saw explaining A*, and luckily it works fine. The pathfind function outputs ...
Here is a project that I worked on for a few days in June 2020. Since the algorithm is extremely slow, I looked into methods in order to parallelize operations but did not obtain any satisfactory answers. https://github.com/aaronjohnsabu1999/tk2NN The project is a Tkinter implementation of the k-Nearest Neighbor (kNN) ...
I've started bash scripting recently and currently I'm working on a program that simplifies backuping using rsync . I'd appreciate any feedback on what I've done wrong / what can be improved. #!/bin/bash # Copyright (C) 2020 ##########, e-mail: ################## # saver comes with NO WARRANTY. This program is comple...
How can I improve the readability of the below function using a list comprehension? Also, is there a way to improve items() performance? pricing = {'prices': [{'product_id': 1, 'price': 599, 'vat_band': 'standard'}, {'product_id': 2, 'price': 250, 'vat_band': 'zero'}, {'produ...