instruction stringlengths 71 95.1k |
|---|
I tried solving the following problem by following the suggested approach to solving the problem in the problem tutorial. However, the online judge still says my solution exceeds the time limit. Is there a way to optimize the program to perform faster?
The Problem:
You are given \$n\$ strings \$s_1, s_2, \dots, s_n\$ ... |
Function
Calculates values for user defined equations. Just a concept right now. I plan to add many more equations.
Equations in code
Density:
$$ p = \frac{m}{v} $$
Speed:
$$ s = u + a \cdot t $$
class Equations:
def __init__(self) -> None:
self.p = lambda m, v: m / v
self.m = lambda p, v: m * v
... |
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#define ENTRY(x) {x, #x}
#define STRING_M(x) #x
static int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) {
/* loop over all rtattributes */
while (RTA_OK(rta, len) ... |
Problem: https://projecteuler.net/problem=51
"Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family."
repository: https://github.com/steven-omaha/euler51
dependencies: num
This code is my attempt at solving Project... |
Here is the context first. I have a 'Stock' table, in which I record all the stocks with as information: the product, the quantity, the batch number and the expiry date.
However I have a constraint: I cannot have for the same product 2 records having the same batch. For instance:
product | qty | batch | expiry_date
---... |
I haven't used Unix, etc. for 40 years, so I am a bit rusty. I need to back up the databases on my website(s) once a week and then retrieve them automatically from my development machine. So this is step one and is working fine as a crontab job on Apache. It emails me a message with status/error.
I am creating a fo... |
Over the week, I was assigned to create a function in a Jupyter notebook that satisfies the Spearman Correlation formula without the use of any packages e.g. Numpy, Pandas. Below are the rules of the game, followed by solution.
I am seeking any input on how this could be done more efficiently.
The Spearman rank correl... |
This post is about an Iterator iterating over simple loops of an undirected graph.
In the above graph, the cycle \$\langle 1, 2, 3, 4, 5, 3, 1 \rangle\$ is not simple, but, for example, \$S = \langle 1, 2, 3, 4, 1 \rangle\$ is. Also, note that \$ \langle 2, 3, 4, 1, 2\rangle\$ is a simple cycle too, but it encodes the... |
I'm at the end of the IBM Data Analyst course, and I wanted to ask for a rating of a piece of code I wrote as a solution to its exercises from the final chapter. I know I could write it on the forum of the course, but I will finish it very soon and have no access to the forum before anyone will answer.
Exercises:
Creat... |
I am a beginner programmer and have recently finished coding a clone of the game Wordle.
I want to know if the way I programmed this game is efficient, solid, and overall good code. I also want to know how I can know whether my code in the future is good or not.
Here is my code:
(by the way, the opened txt file is a te... |
The Game
Go or weiqi is an amazingly simple yet complex board game. This game is typically played on a 19x19 grid, and pieces are played on the intersections of lines. Pieces are removed when they are surrounded by opposing stones on all orthogonally adjacent points, in which case the stone or group is captured and rem... |
I'm super new to coding. I had a random idea in the car to make this application in order dive head first into learning to code.
This is an app to take an MP3 file, "shred it" into pieces (creates 1 second mp3 files temporarily), then randomize the pieces, and then compiles a new MP3 file with all the "shreds" in a ran... |
The need (context).
Several times a day, we need to migrate a set of digital assets from one system to another. The process uses memory (the assets are held in memory for a short time) and we need to do our best to keep the memory capacity down. Fortunately, we have some flexibility (there is no hard ceiling) but ther... |
I want to load JSON data from a link at the beginning of an application.
I need to be a little bit about clear the following code.
And also want to ask about another opinions that what could be the best approach if I need to read from a URL and want to read data from this resource.
package com.app;
import com.app.enti... |
I am trying to solve the lowest common ancestor problem in Rust. It is guaranteed that the id's of the tree are unique. It is also guaranteed that the two nodes which we are looking for in the tree actually exist. My code is below.
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::VecDeque;
// Definition... |
I wrote a program that can take any English text and transform it into an integer and vice versa.
My method
I use two dictionaries to map between letters and numbers. I chose base 32 because it is a multiple of 2, so I guessed that would be easy to work with.
The pairing is
0 ⟷
1 ⟷ a
⋮
26 ⟷ z
⋮ (some other characte... |
How can I improve this code or make it tidier?
public class Point2d : IEquatable<Point2d>
{
public double X { get; set; }
public double Y { get; set; }
#region constructor
public Point2d(double x, double y)
{
X = x;
Y = y;
}
public Point2d(double [] points)
{
if ... |
I am attempting to clean up my code as best I can, but I am new to powershell and would like other's opinions on if there is anything else I can clean my code up with and any tips to overall improve writing my code in the future. This code is meant to:
Disable a registry key in the background so that users can control... |
I'm writing software which allows a user to view data in a number of different formats, and they can switch between formats at any time. I'm wondering if there's a better way to do this than switching between subclasses, and if not, if there's a better way to write this than I have.
import tkinter as tk
from tkinter im... |
I am writing a resolver for a typical updateUser mutation with node, Apollo Server and mongoDB. I want to make it such that, when the email input is provided, it will update the email; when the password input is provided, it will hash and then update the password; and when the plan input is provided, it will update the... |
This code was a challenge from a friend. Essentially she wanted a way to
"Divide an even number into 2 even numbers."
So I made this quick and dirty Python program to find the solutions up to 1000000.
I'd like to know if there's a way to make it faster and improve readability.
from progress.bar import Bar
def checkso... |
I`m currently trying to delve into x64 assembly under windows using NASM, and created a minimalistic "Hello World" application.
It is mainly meant as an educational resource for me and possibly others, hence the heavy documentation style.
A full repo with build instructions and code is located at hello_kernel32, this i... |
I have created an accounting database as per my accounting knowledge.
I want to check: Is that database correct which I design for the accounting system?
I have table called Mst_AccountGroup(Asset,Liabilities,Capital/Equity,Income & Expense data to create a chart of the account).
The database structure is given below.
... |
The code works perfectly.
It looks for a certain parts of the screen where the terraria fishing particles would be appear, after which it if the threshold is met it fishes. I was wondering if it was to bad have 2 completely separate functions for each location, Corrupt_Check() and Normal_Check().This is because in the ... |
I am working on a web page where there is a checkbox with a value and a hidden field. I want to ask your opinion on whether this logic is sound.
My logic
The checkbox has a value that matches the id of the hidden field. I have a function that sets all the hidden field values based on whether that checkbox is checked. I... |
I have to do an experiment to predict student performance using Deep Learning. We can try applying these models and compare the accuracy, precision, recall, and F1 score. (Also, we can try only fully connected NN to be used as a baseline)
CNN with one dimension as the input
Fully connected, followed by CNN
CNN follow... |
I'm new to Rust and still getting used to the ownership model. I'm done with chapter 8 of the book and was trying to solve this exercise:
Given a list of integers, use a vector and return the [...] mode (the
value that occurs most often; a hash map will be helpful here) of the
list.
Here's my solution:
use std::colle... |
The code below works. The question is if there is a better and more elegant (maintainable) way.
The task is to update a Python dictionary which values are lists with another dictionary with the same structure (values are lists). The usual dict.update() doesn't work because values (the lists) are replaced not updated (v... |
Real case: I need to retrieve data from a web service (main process), but in case that web service is taking too long, I retrieve the data from the cache (that data might be older) in a parallel process (alt process). If the main process completes first, I return that data. If the main process doesn't complete before t... |
The common implementations usually reference: https://github.com/fmatthew5876/stdcxx-bitops/blob/master/include/bitops.hh
I styled my version to match (except for the constexpr macro):
template <typename Integral>
constexpr Integral extract_bits(Integral x, Integral mask) {
Integral res=0;
int bb=1;
do {
... |
I'm a beginner trying to make a Wordle clone in python. I already have most of it sorted out but am concerned about my code being difficult to read. The part I'm struggling with the most is the algorithm for how guesses are displayed.
An easily overlooked aspect of the original game is that it tries to make the player'... |
I wanted to try out classes in Javascript and implemented a snake game. You can control the snake by using the arrow keys.
I would be interested to know if the source code can be improved in terms of class structure or source code structure in general. I never implemented snake in an other language and also didnt look ... |
Given an arbitrary list of operations as follows:
operation1 = [('Red', '<', 10)]
operation2 = [('Red', '<', 10), ('Blue', '>=', 10)]
operation3 = [('Red', '>', 1), ('Blue', '>=', 10)]
Constraints
A list of operations will have the following attributes:
Color: String
Operator: <, <=, >, >=, ==, !=
Value: Integer or a... |
I have re-written this javascript code logic to a react custom hook to use.
But it seems like the solution i have made is a bit slow, and heavy on performance, I was wondering in which sort of ways I could make it more performant.
This is the custom hook:
import { useEffect, useState } from 'react';
import { isBrowser ... |
I am working on a CLI chess game that only involves 2 human players, I decided to make it follow the MVC architecture to ensure separation of concern and to make the possibility of a GUI/web integration easier to achieve.
Here is the package diagram:
The view only has the View class that draws the board and the pieces... |
rules
UnWordle is a word guessing game in which it shows you a n*n color grid and a base word. The goal of the player is to fill words into the grid such that it follows these rules:
a green brick must contain a letter from the base word with correct positioning.
a yellow brick must contain a letter from the base wor... |
I am trying to write a program to generate splats from point clouds from following this paper and this paper.
The function I have to generate 1 splat is here:
def generate_splat(pcd, pcd_tree, point, k, threshold, perc, points, activated):
[k, idx, _] = pcd_tree.search_knn_vector_3d(point, k) #Find k nearest neighb... |
Critique?
#include <iostream>
#include "boost/pfr.hpp"
//////////////////////////////////////////////////////////////////////////////
void print_struct(auto&& s) noexcept
{
using S = std::remove_cvref_t<decltype(s)>;
[&]<auto ...I>(std::index_sequence<I...>) noexcept
{
(
[&]() noexcept
{
... |
I created this short code as an exercise to learn and practice my OOPS. The aim is - given a string of points as x1,y1,x2,y2... figure out how many of them lie inside a given rectangle.
Can anyone please point out what things I can improve in this code design and best practices wise.
public class Solution{
private... |
I am trying to do a few exercises from the K&R book from the first chapter - exercise 1-19. I have to write a program "detab" which replaces tabs in the input with the proper number of blanks to the next tab stop. Assume a fixed set of tab stops, say every n position.
Here is what I've written so far (My Solution):
#in... |
I currently have a script that fires a request to an API endpoint which returns a csv.gzip file - which roughly contains 75,000 rows and 15 columns. I download this files to the webserver disk storage, unzip the file to .csv and then loop through every row and add the data into my database. Finally deleting the files s... |
I am trying to build an object that group all methods to make http GET, POST, PUT, DELETE requests with fetch API. I would like to accept objects and formData without having to specify the content type in the headers.
First I tried to switch the headers inside class as 'Content-Type': 'application/json' for objects and... |
Let T be a semistandard Young tableau of rectangular shape. For example,
[[1,2,4],[3,5,6]]
is such a tableau, where [1,2,4] and [3,5,6] are columns. All non-crossing tuples with the same content as T are
[((1, 2, 3), (4, 5, 6)),
((1, 2, 4), (3, 5, 6)),
((1, 2, 6), (3, 4, 5)),
((1, 4, 5), (2, 3, 6)),
((1, 5, 6), (2... |
I am implementing a generic absolute value function that handles signed and unsigned integer values correctly over the input type's domain. The std::abs(...) function leaves the case of std::abs(INT_MIN) as undefined behavior cppreference. I hope to resolve the undefined behavior by representing the returned absolute v... |
My idea is to understand the limits of python turtle, it is a conscious choice and I understand that any other library would probably suit better. I don't use OOP, as I don't think that it would make any difference in such a small game. Right now I would say that the game is playable, but nowhere enjoyable. I am lookin... |
I am a beginner in javascript and I have made this project as a part of The odin project.
Feautres:
Draw by hovering the mouse on grid
Erase
Clear the entire sketch at once
Reset the grid size
I have created the grid using only flexbox.
Here is my code:
function createGrid(grid, rowSize, colSize) {
for (let i = 0... |
This program converts a proprietary text data format to the conf or ini file format. I have some questions on the code:
Is the high level code design coherent and easy to read?
Does the code use 'good code design practice'?
How could this code be improved?
The input format is a filename to describe the 'subject' of ... |
Many thanks for your valuable comments in my previous post.
In my previous link Accounting system data database design
The primary key and foreign key was not assigned i was thinking handle from front hand side, but as your suggestion and comments i did changes in the database structure, kindly please check.
CREATE TAB... |
I’m starting to learn C++ by doing a lot of exercises. I want you to point me to where/what improvements I can do to make my code better.
The exercise:
write a URLencode function that takes a string and searches for spaces and replace them with %20
My solution:
#include <iostream>
#include <string>
#include <cassert>... |
I wrote the following code for the cs50 pset1 credit and it passes all the checks. However, I think that it is too long (specially the last part) and would like to improve it. I would be very grateful, if someone could check my code and give me some feedback.
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#inc... |
I've written a C implementation of a hashmap of strings including the basic operations and a strategy for handling hash collisons.
Additionally, I've included some tests, specifically for cases involving hash collisions which, I confess, gave me a bit of trouble initially.
Thank you in advance for your time :)
ps, if y... |
I have the following js script for my logon page. It feels like a long run on sentence. It works but wondering if there is a better way to structure this.
window.onload = function(){
//define form elements
const remBox = document.querySelector('input[type="checkbox"]');
const alerts = document.getElementsByClassN... |
The code below calls the parse_config() function which populates the global variables user, passwd and host which are later used in main() function:
#!/usr/bin/env python3
import sys
import configparser
def parse_config(cfg):
"""
Read the configuration file.
"""
global user, passwd, host
if cf... |
I have a server side logs folder that contains many hundreds of logs most of which are in subdirectories according to the machine the logs have come from. The task is to extract the full path of the latest file in each directory where the file contains a particular string (not all files have this string) so that analys... |
The following logic provides iteration over /proc/<PID>/maps for a Linux process. What I'm primarily (though not solely) interested in for this review is whether or not I've made any invalid assumptions about the layout of the maps file.
iterate_map.h
#ifndef REAP_ITERATE_MAP_H
#define REAP_ITERATE_MAP_H
#include <st... |
Instead of using 45 IF conditions , I put my two ranges into variant arrays.
Then I used the below code to loop between them and change values of the first array arr1 second elements based on condition.
the first range is only 10K rows and the second range is just 45 rows and code takes about 0.7 second to finish.
I tr... |
I am trying to display data in JSP and i am wondering if there is a better way then what i have done. I am not really experienced in Java or JSP so the code i made is probably not the cleanest.
I will only be returning count from my database as shown below so i will not be returning huge amounts of data i just need the... |
I'm building a java client interacting with a server that returns responses with rate limit info in the headers:
rate limit per period (for instance 10 per second)
remaining limit left until next period
start of next period (epoch time in seconds)
So I built a rate limiter that doesn't follow a fixed rate, but adapts... |
I have a list
list = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
If I give an input of Saturday, then it should return the next day (Sunday) and the previous day (Friday). My program works, but I am looking for a simple function to print the next value in the list for a given item.
My code... |
I’m starting to learn C++ by doing a lot of exercises, and I need your help so I can improve,
Here is how it goes, I will try to solve an exercise and post both the exercise and my solution to it,
And I want you to point me to where / what improvements I can do to make my code better, this would help me both uncover mi... |
I started writing a card game in C++ yesterday, just as something to do to familiarize myself with the language. When I showed it to a friend of mine in the compsci field he said I should share it here for advice on how to improve.
The program's basic functionality right now is it can build a deck of cards, shuffle it... |
I am a novice in assembler programing, I will will appreciate if someone could review these NASM assembler code for me. Is about encoder decoder.
The encoder performs the following:
pads the shellcode with NOP opcodes so it is 4 bytes aligned
a random byte is generated for each 4 bytes of the shellcode
the 4 bytes a... |
Here's my attempt at reimplementing part of https://diep.io/, a 2D game where tanks battle with each other. The tanks are circular and they have cannons which fire bullets. The bullets can hit other tanks and they disappear after three seconds. Here's a random YouTube video if you want to see how the original game work... |
I recently created my first API, I intend it to be open source so anyone can contribute, what are the best practises I missed? What should I include in the API? For now it only does contain single endpoint /Items but I want to consult with more experienced devs before moving onto other endpoints.
Code straight from rep... |
The project I've working on is designed with the intent of being able to quickly and efficiently identify discrepancies in live sports betting data that comes from web API's in json format. The first step is to retrieve the json's and I have incorporated async for that. Each json is structured differently so it gets pa... |
I am currently running multiple macros on a large volume of files however watching it go through its processes today I realise one of my issue is that my loop runs through my workbooks 3 times instead of actioning everything it needs to and then moving onto the next file.
This task goes through around 18 files that hav... |
Trying to design a threadsafe lru cache using a reentrant lock.
Currently I don't like the tryLock in a loop approach.
Any inputs on making it more optimal in terms of concurrency?
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
import java.util.c... |
In Python I know packages like click or argparse to implement command line interfaces.
However, I'm in search for something the other way round. Something like a commandline assembler.
I need to set-up some complex command strings in python before executing them using subprocess.
Currently, for every command line tool ... |
Recently on Stack Overflow, a now deleted question was wondering how to convert one particular model of JSON that their code was outputting to another. The OPs main issue was that the JSON generated by their sheet_to_json (I assume it was some sort of CSV file) looked like so:
[
{ 'First name': 'A', 'Last Name': 'B', '... |
I'm a former C# programmer, updating my rusty C++98 (perhaps I should try Rust instead) to modern C++20. My main goal is to get used to C++ standard library types and algorithms.
I chose to solve a palindrome quiz, finding the largest palindrome when multiplying two N-digit numbers. Basically it's a harder version of t... |
This is a fun exercise that tries to answer the following question: if the elements from a square matrix are randomly chosen from 0 to 9, is it more like that the determinant would be even or odd?
I'm pretty sure there are different ways of optimizing this piece of code.
The first one that comes to my mind is to use on... |
I created a way to create turing machines and implemented one that increments a binary number as an example.
This is the turing machine itself:
use std::fmt::{self, Display};
pub struct TuringMachine<'state, TapeItem: Default> {
tape: Tape<TapeItem>,
current_state: &'state dyn State<TapeItem>,
}
impl<'state, ... |
I'm an amateur at assembly, but am trying to get better at it. For fun, I decided to write code that takes in a char array and increments the number represented in binary.
Here are a few input-output examples:
inc("10001010") = "10001011"
inc("0") = "1"
inc("1") = "10"
inc("100") = "101"
Code:
section .bss
result:... |
I would like to get some feedback of my K-Neighbors Implementation using Abalone Dataset and cross-fold validation.
How can I make it more efficient? (No sklearn library allowed)
Where do you see any problems?
import numpy as np
import pandas as pd
column_headers = ['sex', 'length', 'diamater', 'height', 'whole_weig... |
I have written this function to load data from the database, change it asynchronously and return the new data. It appears to work fine, but since I am new to Kotlin, I wanted to ask if this code is ok by industry standards.
override fun update(resourceCommand: UpdateResourceCommand): List<Resource> = runBlocking {
... |
I am trying to solve LC126, and got a memory limit exceeded for the following solution.
I've seen the answer here -- so I'll try to use Dijkstra as well, but I would like to understand why I get the memory limit exceeded, and to learn how I could improve my code.
The main idea: BFS on paths, i.e. from start word, build... |
I wrote some code that set the last few elements of an array to zero. I call these last elements the "excess":
const MAX_DIGITS: usize = 20;
pub fn zero_excess_digits(digits: &mut [u8; MAX_DIGITS], n_digits: usize) {
for i in n_digits..MAX_DIGITS {
digits[i] = 0;
}
}
However, Clippy considers this a ne... |
How can I get to a perfect coding for this algorithm?
I made the mathematical theorem, which is a development of the Sieve of Eratosthenes algorithm. I might use some help in coding.
You can find the description of the code at my paper:
Development of Sieve of Eratosthenes and Sieve of Sundaram's proof
For more underst... |
I'm doing a few challenges and I found this one on Codility:
A binary gap within a positive integer N is any maximal sequence of
consecutive zeros that is surrounded by ones at both ends in the
binary representation of N.
For example, number 9 has binary representation 1001 and contains a
binary gap of length 2. The n... |
I have a value test-1 and a list of keys as below:
[
["initial", "short_title"],
["later", "datasets", "item_okmiwt"],
["general_title"]
]
I wanted the resulting dictionary like this:
{'initial': {'short_title': 'test-1'}, 'later': {'datasets': {'item_okmiwt': 'test-1'}}, 'general_title': 'test-1'}
I have writt... |
I have a question about how to check if two tableaux are compatible (will define below). Here we only consider tableaux of rectangular shape.
A tableau is called semistandard if its rows are weakly increasing and columns are strictly increasing. We say that a semistandard Young tableau has small gap if it is one colum... |
I have this Java program that asks for a name of the file containing data rows in the format $$
x_1\ y_1 \\
x_2\ y_2 \\
\vdots \\
x_n\ y_n
$$, and outputs on the command line the Pearson correlation coefficient of the input data:
com.github.coderodde.stat.pearson.PearsonCorrelation.java:
package com.github.coderodde.st... |
I am extracting data frome a given text file into a python dictionary for further processing
Input:
---------------------------- SECTION-A ----------------------------
Parameter1 : Text 1
Parameter2 : Text 2
Parameter3 : Text 3
Parameter4 : Text 4
Parameter5 : Text 5
Parameter6 : Text 6
Par... |
I'm working on a repo the purpose of which is to create and manage a local PostGIS server. (PostGIS is a bit niche, but it boils down to a few extra spatial data types and built-in SQL function. With a couple of commands you can install these extensions on pretty much any Postgres database.)
My current workplace involv... |
I'm new to rust and tried to implement a singly-linked list as exercise.
Is this code so far suitable to solve the problem? What elements of the language should I consider to make the code more elegant?
#![allow(dead_code)]
use std::{
fmt::{Debug, Display},
ops::Index,
};
struct List {
value: u8,
next... |
The following code will be used to generate a random json object to be used as a RabbitMQ message body. The code works but I'm sure it can be improved in ways that I am not seeing, as I am a novice.
First and foremost, I want this to be idiomatic. After that, readability and reusability are my priorities. I'm not reall... |
i made this python program to scrape and save the daily maximum pollution values in mexico city, the data will be used in machine learning but i wonder what could be improved:
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverW... |
I have this code:
func solution(_ num: Int) -> Int {
let arrayOfTen = Array(0...num)
var setOfmultiples = Set<Int>()
if num <= 0 { return 0 }
var sum = 0
for element in 0..<num {
if element % 3 == 0 || element % 5 == 0 {
setOfmultiples.insert(element)
sum = set... |
My goal is to have a timer function that operates from the bash linux command line. I am looking for review and feedback. Printing the expected number of characters (dots, dashes, or bars) is nice-to-have, not a must-have.
For instance, I type "timer 10", and the function waits for 10 seconds before saying "timer com... |
I have a df and need to count how many adjacent columns have the same sign as other columns based on the sign of the first column, and multiply by the sign of the first column.
What I need to speed up is the calc_df function, which runs like this on my computer:
%timeit calc_df(df)
6.38 s ± 170 ms per loop (mean ± std.... |
I just finished implementing a Java 2 player CLI chess game, it involves player putting in commands (i.e "move e2 e4" to move or "attack d1 d5" to capture.).
I am trying to follow OOP, SOLID and clean code principles as much as possible.
Initially I designed this with the idea of MVC with the current implementation try... |
I wrote some code and thought I may get better with some feedback. I program for almost 5 years, mainly in python.
I care most about the unit testing.
I am not really sure, how industry standard unit tests in python look like.
storable.py
import os
import uuid
import logging
from os.path import *
from typing import Ty... |
How can I make the code easy?
The function which was developed contains the following inputs:
students: a list with names of students
events: an integer specifying how many group assignments should be created
group size: an integer specifying how big a group can be at maximum.
The function should return a list of gro... |
Preface
This question is a re-implementation of my other question here.
The Game
Go or weiqi is an amazingly simple yet complex board game. This game is typically played on a 19x19 grid, and pieces are played on the intersections of lines. Pieces are removed when they are surrounded by opposing stones on all orthogonal... |
Project description
I'm making a website listing products. The listing goes as following (See here):
Product name
Shop name
Price in that shop
If the product appears multiple times in the table for the same user (Which means he/she selected it in multiple stores. Merge them and just show multiple shop names)
Exampl... |
This work is motivated by Sum of natural numbers below threshold, where several Swift solutions to Project Euler #1 (with arbitrary upper bound) are provided.
One way to think of it is to
start with two sequences (the multiples of 3 and the multiples of 5),
merge these two sequences into a new sequence, in increasing ... |
I have to solve the task which finds the count of values, are smaller than the current one, located to the right.
Here is the example:
# We have list
list = [5, 4, 3, 2, 1]
First answer is 4, because we have 4 values to the right are smaller than the first one is 5.
Second answer is 3, because we have 3 values are sm... |
I wrote a function to download a large zipfile 5-7gb from Iowa State MRMS data archive.
The zip files appear to be malformed and results in a BadZipFileError hence the fix_badzip function which calls a subprocess to repair the zip.
after the zip is repaired I have a function to filter the ZipInfo for select files.
The ... |
I have been tinkering with a script that should list things that are listening on the network, but are not part of the base packaging manager. Currently I have only done support for fedora and debian based systems.
Due to constraints on the system I am working on I have to support Bash 3.2 and above. This meant I got a... |
How can this be improved?
I'm looking particularly at the twice repeated tabButtons.forEach(button => {
const tabButtons = document.querySelectorAll('[data-tab-button]');
const tabContent = document.querySelectorAll('[data-tab-content]');
tabButtons.forEach(button => {
button.onclick = () => {
tabButtons.f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.