instruction stringlengths 71 95.1k |
|---|
Remote-Computer-File-Transfer
I have created a PowerShell script, , for remote computers file transfer, for computers that only support New-PSDrive cmdlet, and I would like someone to take look at my code and give me guidelines on what I am doing the wrong way and what I am doing right.
The Script
Description
This scri... |
I wrote a simple prime number program that checks if a number is prime or not using sieve of eratosthenes, I also wrote an optimized version that only generates the sieve_arr when the val exceeds the length of sieve_arr.
sieve.py
# sieve.py
from array import array
from math import sqrt
def sieve(n=80):
"""Sieve o... |
Updated (at the bottom)
I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort() function). I used the def keyword to create the sorting_function() (the code bits in this paragraph will make more sense once you see my code) so all I ha... |
Last week I was challenged in a technical interview with a code challenge about threads and efficiency.
The challenged required to create a service to detect whether an ID had been already seen or not.
The requirements were simple:
Return true or false if a given id was already seen or not
Duplicates are not allowed, ... |
I am relatively new to java and I am trying to set up a class with non-trivial setters, but I wonder if setting an instance variable via another one is allowed/good practice?
public class Pdf {
private byte[] bytearray;
private String name;
private PDDocument pddocument;
private int lastPage;
publ... |
This is the first real program I have written in rust. What started as a clean piece of rust code, turned into a lifetime monstrosity when I decided to make my enums and structs use &str instead of String. The algorithm implemented is irrelevant; I just need help making my code more idiomatic and clean. Here is (quite ... |
This is a follow-up question for An arithmetic_mean Function For Various Type Arbitrary Nested Iterable Implementation in C++. As Toby Speight's answer mentioned, some self-checking unit tests are needed to verify the correctness of arithmetic_mean function. There are numerous possible ways to construct test iterables ... |
Context
I was making a Convolutional Neural Network from scratch in Python. I completed making it .... It works fine ... The only thing is that it takes a lot of time as the size of the input grows.
Code
import numpy as np
import math
class ConvolutionalNeuralNetwork():
def __init__(self, num_of_filters, kernel_sh... |
Please find my code for securely checking Haveibeenpwned for breached passwords
This code will only send a partial HASH over the internet (using HTTPS) and the second part of the HASH will be checked on the users side. Therefore, the full password will never be seen by anyone including haveibeenpwned
import hashlib
imp... |
I created a simple quiz about HTML,CSS,JS it works fine but as always there is a lot of space for improvement in my code that's why I would love some feedback from you guys.
'use strict';
// ########################################################
// ########################################################
// ########... |
The code generates a list containing all possible combinations of the items of an array. Every triplet of items contains two operands and the third item containing "-0.0" or null, depending on the result of the given BiFunction applied to the operands. The list then is printed out, with additions for better readabilty ... |
https://arxiv.org/pdf/2009.07047v1.pdf
I don't have a lot of experience in building a network model. I would like to build the Encoder and Generator network model from the above article.
Here is my attempt :
import torch.nn as nn
class ResnetBlock(nn.Module):
def __init__(self, dim, norm_layer, activation=nn.ReLU(... |
Introduction
I have just started learning templates and experimenting with function pointers. I wanted to create an event system that met a couple of goals:
Event types are PODs, and do not inherit from a base 'Event' class
External API is simple, no binding or passing in lambdas etc.
No explicit registering of event... |
I am using Log4j2 for logging. Multiple operations return success code. If status 0 is received, it means operation is successful, else failed. If operation is successfully, I log "*** is successfully." and if it fails I logs "*** failed with status : " + status. This is kind of repetitive in code.
public class ReadCa... |
I'm currently working on a live keyboard demo on unity. I've animated every key but my script spans over 2000 lines. I'm fairly happy with my script but I know theres better ways to do it.
I have defined functions and if statements for each and every key.
I'll post my code below
private Animator Alpha1Press;
private An... |
I am trying to create a simple Python project. It's a minigame about guessing a number.
It's a game where the computer will pick a random number from 1 to 10.
The player needs to guess it correctly.
Every wrong attempt will give you a clue.
3 clues and the player will lose.
I've built the code and it works just fine.... |
I am writing a part of the program where speed matters the most. In that part I am creating color spaces like RGB and other. In-fact I wrote these 2 structs.
struct RGB {
unsigned char r;
unsigned char g;
unsigned char b;
}
struct ARGB {
unsigned char a;
unsigned char r;
unsigned char g;
un... |
I'm writing a very simple CRUD application, and I'm wondering if the way I'm using static methods throughout the code makes sense. I'd very much like to simplify the code if possible.
Any feedback and criticism is very much welcome!
<?php
class Database {
private const DB_DSN = "127.0.0.1";
private const DB_... |
While working through a challenge in the beginning of a book I'm reading. I wanted to make my first program more versatile in its responses while trying to fix any exceptions that it was throwing at me. I'm not really sure how well I've made it and I'm looking for any advice on where I can improve it. Here is the progr... |
Program description:
A program accepts a list (uTable). The list consists of at least 4 different lists (rows), each with 7 elements (cells). Check whether the value in [7] is zero and assign a new random variable to it on the basis of what [3] is: 1, 2, 3, 4 or 5. A chance should be used to calculate the chance of th... |
This code is supposed to be the "user" system for my app. This will ask you what you want to do...
If you want to add a user, remove a user or check the list of saved users.
With this I learned how to open and edit text files. And my goal doing projects is keep on learning and maybe someday I will be able to work or pr... |
I've been learning C# for 2 month and in the process of writing a quiz via file i/o. I want to know if there is a better way to getting the questions and answers rather than using switch statement so that it does not look too cluttered. I've tried using fields and properties but I don't know how to implement them into ... |
There is a remote resource containing datasets arranged by time, data is static and doesnt change. Whenever we are going to fetch anything from there we will be saving it in our cache.
User might request a data for a particular time period, lets say from 1st Jan 2019 to 1st Jan 2020. If data is not cached, then we requ... |
I'm using C++11 with https://github.com/SmingHub/Sming. It has no support of std lib or exceptions. I wanted to use Either monad to return an error or result from my functions.
I implemented it using class hierarchy. I'm not a native C++ dev so I would be glad for the code review.
#pragma once
template <class L, class... |
The searching algorithm that I created is dependent upon the sorting algorithm (which many of you have seen in my previous question). I believe that the sorting algorithm can't be better (for beginner-level programmers like me) but I would like to know what you think about my descriptions for the searching algorithm.
I... |
I've made a memory match game, where the users can draw each card.
When the program is ran, there would be a canvas that allows the user to draw in.
When the user is done drawing, they can press ENTER, and another fresh canvas will appear.
The user may repeat the process, drawing as many card designs as needed, and whe... |
I have been working on implementing rate limiter in Java. Following is my approach.
I have used 'sliding window with counters' technique to implement this rate limiter.
What I do is instead of rate limiting per second I rate limit per minute. This allows me to create 60 buckets (one for each minute) for each hour for e... |
I started Python 3 days ago. This user login code is the first project I completed, not following along with a tutorial. The idea is that you can create a user and login with it. I am wondering if there are ways to make this code much more efficient or shorter. If it needs anything, I'd love to learn new things.
def ch... |
I am trying to pretty print the directory structure defined in a JSON. I do have a solution using recursion but I'm looking for feedback on how this solution can be improved or if there's any better approach.
Problem Statement
A deeply nested directory contains following information:
Name
Data (can be an array of sub ... |
I am trying to resolve following problem to improve my DS knowledge. Please advice which part of the code can be improved.
You run an e-commerce website and want to record the last N order ids
in a log. Implement a data structure to accomplish this, with the
following API:
record(order_id): adds the order_id to the lo... |
I'm working on an application that allows users edit/fix XML.
A part of this is to format the XML for better readability.
As the XML might be invalid, the existing methods I found for formatting (like XmlWriter or XDocument) don't work for me.
There might be all sorts of problems with the XML, although the most common ... |
This problem is from https://adventofcode.com/2020/ day 1.
I need to find the N entries of inputs that sum to 2020 and then multiply those N numbers together.
inputs = [1721, 979, 366, 299, 675, 1456]
I have 2 cases N = 2 and N = 3
I have done this with list comprehension
N = 2 :
main = print $ head [ i * j |
... |
This is a follow-up question for A non-nested test_vectors_generator Function for arithmetic_mean Function Testing in C++ and An arithmetic_mean Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides std::vector test cases generated from test_vectors_generator template function, I am trying ... |
In sort(arr), I want to sort an array. Children must be beneath their parent. And children of the same parent are sorted using orderPos value.
I guess the complexity of this algorithm is quite high, is there a way to make it more performant for very long lists?
(the language used here is typescript)
interface data... |
I have programmed a A* Pathfinding algorithm in the Console. I would now like to know if there are any things that I could do to improve the time it takes, to find a path. Right now it takes around 80ms.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
... |
I'm brand-new (just joined today) to code review and I am super excited to share my tic tac toe game code with all of you! Please let me know what I could fix up in my program to make it more efficient. Thanks in advance!
P.S. I'm also not sure how to add an actual board to this game (an actual board rather than the wa... |
I'm not sure what %s means in Python strings. I came across this line of code somewhere a while ago: print("On your journey to %s, you drove at an average speed of %s miles per hour." % (where, speed)) and I just came across a question with the following line: print("The", count, "prime number is %s" %index). And how c... |
I tried implementing a state machine in C.
This is for a Stratosphere Balloon and I wanted to use a state machine to make it better.
This will be later implemented in ARM CMSIS.
The state function doesn't really do anything yet. And the while(1) loops will be replaced by the sbRepeat transition code.
#ifndef _SB_FSM
#d... |
UPDATE: I have added:
a play-again option
score keeping thing
difficulty levels
**(but I still need help with the functions part).
I don't feel it's necessary to explain what my code does, as it is pretty self-explanatory. I have the entire program completed, but I need to put some of the components of the program in... |
The following function sets a query for MongoDB, but that's not very important. It takes 2 arguments key can be either - which comes from an empty search by the user in the front end, or any other string. Select can be either sample or all
So it's a switch like this:
|
... |
I'm new to this, but after learning some of this in class I decided to try my hand at creating a program to get the info from a Zybooks signature which stores the run data for your project.
it takes a string in the format (MM/DD..signature..MM/DD) (It does not like when the signature does not follow this syntax)
Signat... |
Today I'm researching how to provide data to UIKit component when using Combine pipeline.
I could see tons of tutorials about how to use SwiftUI + Combine from internet, but not found anyone helpful stuff about UIKit + Combine.
Well, I list one approach here, I put some data works in WebService and mean time receive th... |
In spite of all the POSIX shell disadvantages, I am still sticking with it and I love its portability.
Recently, I was searching for a way of code re-use, which turns out to be structured programming and input validation = Yes, in a POSIX shell script.
Let me begin with the simpler.
is_integer() + is_exit_code()
is_in... |
I have the following code which takes an array that might have duplicate ids and will merge the items of those duplicate, and keep only one element per id which contains all the items of all elements with the same id.
array = [{
id: 1,
items: [1, 2, 3]
},
{
id: 2,
items: [1, 2]
},
{
id: 1,... |
This is my first attemp with Lua.
I decided to create this class, because it have lots of "tweaks" and "tricks".
I want to know if I did it as best practices Lua ways.
My Lua version is 5.4.1
require "math"
Complex = {
IMAGINARY_CHAR = "i"
}
function Complex:new(r, i)
o = {
r = r,
i = i
}
... |
I want to implement color space logic.
So I started with creating some structs:
struct RGB {
unsigned char r,g,b;
};
struct ARGB {
unsigned char a,r,g,b;
};
struct HSL {
float h,s,l;
};
struct Lab {
float l,a,b;
};
As you can see, I have different color spaces in my program: the RGB and CIEXYZ.
The... |
I was hoping someone could review my C++ console based noughts and crosses (Tic Tac Toe) application. I have not looked at any other documentation, this is purely programmed from the top of my head. Can you tell me what I've done well, what I haven't done well, and suggest any improvements I can make to it. If you deci... |
Can someone review my code and provide feedback. For context in column A will be a status message of "OK" or "NOK" and this little function just counts the number of times this appear so I can update a label in another procedure. Not too sure if this is the most efficient way of doing this because looping will create d... |
Just wanted to share my Narcissistic Numbers Program with y'all (not sure if it's good, but I gave it my best). Hope you like it!
This program prints out all the narcissistic numbers from the smallest number and biggest number's range. Ex. in the 1-100 range, only the narcissistic numbers will show on the console.
Some... |
I want to write read savefile function with smart pointers and SDL2. I have little expirience with smart pointers and just want to ask is my code good, correct and no memory leaks.
this is my code:
std::shared_ptr<SDL_RWops> saveFile;
--
int GameEngine::ReadSave() {
int Highlevel;
//Open file for rea... |
Though many have done it the other way around, I have not seen such code in many places. And, to be honest, I don't know why this cluster of if-statements, for-loops and while-loops works!
def parse_int(string):
numbers = {'zero':0,'one':1,'two':2,'three':3,'four':4,'five':5,'six':6,'seven':7,'eight':8,'nine':9,'te... |
A component displays a list of values and I'm trying to hide everything about how those values are gotten, essentially divorcing concerns about state away from the component itself so that in the future any changes to which API data is fetched from, what store is used, etc won't effect the component.
First, is this a g... |
I would ideally like to add event listeners to a single group of elements, topLevelDesktopNavDropdownItems , in some kind of object syntax like {event: function, event: function}. Or is there another way to do this? Here is my current code:
topLevelDesktopNavDropdownItems.forEach(
element => element.addEventListen... |
Below code is for Given an even number (greater than 2), return two prime numbers whose sum will be equal to the given number
my task to reach the lowest time complexity
I tried it differently, but I cannot reach the lowest time complexity - please help, and I am running it on an online compiler.
class Solution:
de... |
I saw another user post their implementation of C++ TicTacToe game and thought what a coincidence! I was just in the process of making one myself after picking up Programming Principles and Practice Using C++, Second Edition by Bjarne.
Would be very grateful if someone could give my code a fresh pair of eyes! Thank you... |
I'd like to have a generic way for validating user provided email with a bias toward ease of use. Does the following do so in a clear way for implementations that have the URL interface available? The sample input below is only intended to exercise the range of expected input and demonstrate it works. The UI is not in ... |
The title says it all, I have written two scripts to calculate dates to test my abilities in programming, one from scratch, without [DateTime], New-TimeSpan and even [math]::Ceiling, and it's really long and complex, and there is a max error of one inherited from algorithm, the other uses builtin and it's significantly... |
Problem description.
I have JSON which comes in bad shape:
data = [
{"ids": [1]},
{"ids": [3, 4]},
{"ids": [1, 2]},
{"ids": [4]},
{"ids": [3]},
{"ids": [2]},
] # LD. List of dictionaries.
I want it to get in shape, like this:
expected = [
[{"ids": [1]}, {"ids": [2]}], # Length = 1
[{... |
I am a Windows power user, a system tweaker, my idol is Leanardo da Vinci, and now I want to be a hacker.
I am extremely new to programming, but I really am a fast learner if I am interested in the subject, now I use PowerShell to hone my programming skills, I have only started learning PowerShell less than a month ago... |
I am extremely new to programming, and I am a really fast learner if I am interested, I have only started using PowerShell in less than a month, to improve my programming skill, this is a script I have written a few days ago, to do what I said in title, I developped it all by myself, completely without help(because whe... |
This is a follow-up question for std::array and std::vector Type Arbitrary Nested Iterable Generator Functions Implementation in C++ and std::deque and std::list Type Arbitrary Nested Iterable Generator Functions Implementation in C++. The only thing different in the previous implemented n_dim_vector_generator, n_dim_a... |
I have a function that takes a falling car's location & velocity as well as the world gravity. The world has a floor, ceiling, and walls that are in fixed positions. The car's x & y velocity can't change once it's airborne, but gravity does force the car down. I'm trying to find exactly which plane the car will land on... |
I have to do some check/match elements with conditions.
A have a list of conditions, each with a specific ID.
I've put for each of my elements an array with the ids of their respective affirmative conditions.
Some elements can share a condition. The goal is to, everytime a condition is "checked" by the user, the code f... |
Can you please share your thoughts on the following simple httphelper in Go? Thanks in advance.
I mainly would like to know whether returning a channel of a custom type seems like a good idea and if so , how could I improve it for only receive chans.
package services
import (
"bytes"
"encoding/json"
"io/io... |
I have a database object that has a field called workdays, it's a array boolean that contains 7 elements representing whether the user is active on the corresponding day.
I need to save this array into the database, I thought the bets way would be to convert the boolean array into a integer (bits) array and convert tha... |
I'm getting started with React, so I took a React tutorial for creating a simple to-do list app.
After finishing it, I read "Thinking in React", and tried to improve what I did during tutorial based on that article.
This is my original code from tutorial:
package.json:
{
"name": "todo-initial",
"version": "0.1.0",
... |
I was wondering if someone could review my object oriented design for my Noughts & Crosses program. Yesterday I posted a procedural version and now I've done an OOP version.
Can someone tell me what I've done well, what I haven't done well, and provide any suggestions on how I can improve this program? I included inher... |
I'm super excited to share my hangman game with you. (haven't added the graphics yet...)
I will be using this program as my final project (for school), but I would like to have this polished before handing it in. I have given my program the limit of 7 attempts, but if the user continues to guess the wrong letters and t... |
I am working on a project which uses JNI. More than once I fell over the absence of type safety working with the variardic function calls. So I came up with this module. It wraps the variardic JNI functions using C++ variardc templates to offer a type-safe alternative. It also features integrated error checking for mor... |
I've done some coding in the past but nothing with OOP and honestly, I cannot wrap my head around using classes and constructors to tidy up my code. I'm used to "calling functions" instead of pasting code over and over again but in Java, the methods and classes, etc. take care of that but man, I'm just not getting it.
... |
I am working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twig. I use the Twig template engine for the front-end views.
I have put together this simple contact form which uses a controller, a view, and no model.
The controller:
class Contact extends CI_Controller {
public function __const... |
I've posted a similar question on: Link
With the help of the other users, I was able to improve the code, but I don't think is the "ultimate" form.
Thats my code now, any help?
Conditions entries example:
[1,2],
[9,6,4],
[3]
[7,1,5,2,3]
private filterElements(userSelectedConditions: Set<number>): Element[]{
const meet... |
I made this FizzBuzz game for my college class and it's kind of ridiculous, but is suppose to demonstrate chain of command so writing it in a little forloop was out of the question. In case you don't know the game, this program counts numbers 1-100 printing them to the console but replace any multiple of 3 with the wor... |
I am a beginner programmer and have made a tic tac toe program in c++. I need some help with my memory management can anyone review and help me. This is my code
// This is a trial for tic tac toe in C++
#include <iostream>
using namespace std;
char *squares = new char[9]{'1', '2', '3', '4', '5', '6', '7', '8', '9'};
... |
I've produced some JavaScript code for a Video Player, but my experience in coding is with C# and the differences between the languages and my lack of experience has made me wonder I'm not following the correct guidelines.
I'm just wondering if anyone doing a once-over would have any good criticisms and pointers they c... |
I am trying to implement a thread-safe LRU cache algorithm, please review my code and would really appreciate some criticism or suggestion.
Some assumptions:
capacity will be larger than 0
Some questions I have:
I know it is better to encapsulate variables in a class and declare them private, but since DDLNode is si... |
I am a newbie in programming, but I do have potential, I am using PowerShell to hone my skills, I have written a simple function to sort strings consisted of numbers humanly (i.e. in a order like 1 2 10 25 32 123), using the basic concept of padding, I would like to see it be expanded so that it can sort strings contai... |
For something I'm working on, I need a function that takes in a one-dimensional array vec of integers and returns a boolean array of the same shape indicating where the n largest entries of vec are located.
For example,
nlargest([0, 1, 3, 5], 2) should yield [0, 0, 1, 1].
nlargest([0, 0, 4, 0, 3, 6], 2) should yield [... |
This is a challenge on Codewars I took years ago. Task is to find all prime numbers that are also a prime number when reversed, i.e. 13 -> 31 is such a number.
This is still the answer with the most upvotes in the categories 'Best practice' as well as in 'Clever'.
Any improvements or thoughts about this piece of code? ... |
I have a complex nested object with an array of objects coming from an API. But the grid tool best works with flattened data. So I came up with this logic that will build the correct object for the grid tool.
To achieve this, it heavily relies on foreach loops and adding object to list object.
Please review the followi... |
I made a calculator in C without #include. Now, I want to make my code shorter and better. But I don't know how.
Here is my code:
int printf(const char *format, ...);
extern int scanf(const char *format, ...);
double pow(double x, double y);
int main()
{
do
{
double num1;
double a, b = 1;
... |
Program description:
You are given a set of two functions: $$f=x^3-6x^2+x+5; g=(x-2)^2-6$$
Plot them using Matprolib on a user input segment [a; b].
My solution:
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interpolate # for smoothing
def func(x):
return [pow(x, 3) - 6 * pow(x... |
I would like to get feedback on my code for Stack implementation written in scala. What can be improved to make it more like scala code. What important helper functions am i missing?
class StackDS[A] {
private var list: List[A] = List[A]()
def push(ele: A) =
list = ele :: list
def pop = {
val pop = lis... |
I need to intersect lots of arrays with each other. Those arrays are like:
$a = array(4 => true, 10 => true, 18 => true...);
$b = array(6 => true, 10 => true, 73 => true...);
$c = array(106 => true, 293 => true, 297 => true...);
In PHP there is a function array_intersect_key, which intersects keys; it works fine but i... |
I'm very new to C++ and am trying to code simple programs to test my knowledge on the very basics of this language. Yesterday, I created a very simple calculator script which allows you to add, subtract, multiply, and divide and set of two numbers. While it is still very basic (e.g. only calculating two numbers), I pla... |
Part of the project I am working on is to maintain the time-of-day, at the sub-millisecond accuracy, while not overwhelming CPU.
The controller has a pretty standard timer, with two registers, COUNTER and PRELOAD. On each system tick COUNTER is decremented; once it reaches 0, the timer posts an interrupt, and reloads C... |
Link to the Problem
Here is my code to compute the length of the longest common subsequence of two integer arrays arr[] and brr[]:
#include <bits/stdc++.h>
using namespace std;
//Dynamic programm solution
int mem[10004][10004];//mem[i][j] stores length of the longest common subsequence, up to index i of arr and index ... |
I made a calculator in JavaScript. Now, I want to rename my functions, variables, and input names. But I don't know how.
Here is my codes:
function Calc() {
var num1 = +txt1.value;
var num2 = +txt2.value;
var ch = +optxt.value;
var result;
if (ch == 1) {
result = num1 + num2;
}
if ... |
I made a statically allocated memory pool for embedded systems. I think it needs a little work but it works fine so far.
How it works: An array of size MEMORY_POOL_SIZE is first reserved in memory and that's actually the space and the whole program uses to get memory from.
The number of allocations that can happen at t... |
I'm new to PowerShell (started yesterday) and was wondering if there is a way of exporting Shell bags, Jump lists, and LNK files from the Reg to a local computer's desktop using PowerShell? I have tried a few things and can export them as CSVs... but I'm not sure if that's going to have any forensic merit (dabbling in ... |
I am trying to implement a thread-safe LFU cache algorithm, please review my code and would really appreciate some criticism or suggestion. (on naming, design, data structures used, anything)
Some assumptions:
capacity will be larger than 0.
If the cache is full and multiple keys have the same frequency, the least rec... |
I have implemented basic max heap insertion and deletion functions without recursion
# insertion
arr: [6,5,4,3,2,1]
# insert 7
arr: [7,5,6,3,2,1,4]
tree:
7
5 6
3 2 1 4
# delete 7
arr: [6,5,4,3,2,1]
tree:
6
5 4
3 2 1
My implementation
def insert(arr,ele):
... |
This is a follow-up question for A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++, An arithmetic_mean Function For Various Type Arbitrary Nested Iterable Implementation in C++, A non-nested test_vectors_generator Function for arithmetic_mean Function Testing in C++ and Non-nested st... |
I have a weather station with a data logger which accepts commands (specified in user manual) and sends back the respective data over a serial interface. In my case, I want to read the current data from the different sensors of the weather station in a specified interval and then publish them on a MQTT topic.
For this ... |
I have the following array, and I want to convert it to an array without duplicates.
const a = [
{
items: [
{ outerKey: { innerKey: 1 } },
{ outerKey: { innerKey: 2 } },
{ outerKey: { innerKey: 3 } },
],
},
{
items: [
{ outerKey: { in... |
This is a simple bash script that I use to compile and run single C++ files for coding competitions.
Features:
Detects if there is a corresponding .in file next to it, and if so uses that as stdin
e.g. if the file problem1.cpp and problem1.in are in the same directory, the script will redirect stdin from problem1.in
... |
I've made a major update to my Noughts & Crosses program, this ISN'T a duplicate! I know it's not good to use system("pause") and system("cls"), however, I just wanted to make the console screen more readable so resorted to these methods to achieve this. I would like feedback on how well I've used std::shared_ptr, the ... |
I've been messing around with merge sort. Instead of doing a recursive division of the array I chose to keep keep track of the middle index of every three numbers. Using the index of the middle number, it sorts the numbers directly around it and then merges the consecutive portions of the array.I'm having trouble figur... |
I have attempted to do Model View Controller in Python for learning. First, I am not sure if dictionaries are faster than lists for about N = 30 (20 to 40) items. Second, how maintainable is this design since I got abstraction but not very much encapsulation? The abstraction comes from abstracting towards to the domain... |
This is a Clojurescript solution to parts 1 and 2 of Day 1 of Advent of Code 2020.
This code is written in Clojurescript to run on Node.js. It can be run simply using lumo and this command: lumo filename.cljs.
Here's a short version of the problem statement:
Part 1. Given a list of numbers, find the two entries that su... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.