instruction stringlengths 71 95.1k |
|---|
How can I improve my VBA code to run faster?
The issue I'm having is that the For/Next commands are taking ~10 hours to calculate and print all of the data. I cannot turn of calculations because I need the values calculated for every node (check_nodes).
I have 1 sheet ("Rating") that performs calculations (25) for eve... |
The task
is taken from leetcode
TinyURL is a URL shortening service where you enter a URL such as
https://leetcode.com/problems/design-tinyurl and it returns a short
URL such as http://tinyurl.com/4e9iAk.
Design the encode and decode methods for the TinyURL service. There is
no restriction on how your encode/dec... |
I am loading a bunch of arrays and putting them into a single array. The loading of the data is negligible, but putting it into combinedArray takes significant time (as in this code).
import time
import numpy as np
start_time = time.time()
st,en = 0,0
combinedArray = np.empty(shape = (30000*30000))
#Get the... |
I am trying to remove a duplicate letter of first or last letter, with an exception of containing 'a' as first letter and 'l' and 'e' as last letter. However, this code does not look efficient to me because, what if I had 20 letters of exception? Could I put this in a string or an array? I would not want to compare eac... |
I have different ViewHolder for different Feed implementations. But I can't use the best practice of having each ViewHolder corresponds to different layout id because i am reusing layout for 2 different ViewHolder (aka. FeedWithImageHolder and FeedWithoutImageHolder)
class FeedAdapter extends RecyclerView.Adapter<FeedA... |
I have written the following function for a CLI tool, it works as expected but it also contains duplicated code.
def populate_teams_tab(self):
teams = self.get_data(self.TEAMS_URL)
returned_list = []
for team in teams:
if self.IS_ROGUE:
if team['id'].upper() == "ROGUE":
#... |
I have got a request from a client to fetch all client user details from AD and finally dump to a db so that they can use it for reporting. I have used DirectoryEntry and PrincipalContext class to retrieve all the information.The user volume is approx. 7500 and for each user I am binding 35 AD attributes in a list of o... |
I am working on a Yahtzee game development for two players that consists of all the categories Full house, Yahtzee, ones, twos, threes, etc.
I have implemented the interface that works for two players and displays the winner at the end of the game, but I don't think it is efficient need feedback and suggestions to impr... |
I am in a situation where I need to determine if a PDF file is either:
Scanned
Searchable (contain text)
To do this, I am simply running the command pdffonts on the PDF file:
# Check if the resource definition indicates this is a scanned PDF
cmd = ['pdffonts', pdf_file]
proc = subprocess.Popen(
cmd, stdout=subpro... |
I would like to know if what I did to achieve to goal of dynamic operators within an Airflow DAG (Directed Acyclic Graph) is a good or a bad practice.
The goal I had to achieve was:
Create a 'x' amount of operators within
a DAG based on the result of an API call. This DAG will run for example every week.
The progr... |
This is a follow-up question based on the original one. Could you please see the updated and refactored version and point at things to be improved in term of logic or efficiency?
I have now know as I have been made aware about the Greedy Algorithm; Math.Max and binary shifting which deal more gracefully with the task, ... |
The following code fetches data from a MySql database to generate a simple report on accrued work time on projects.
I've been away from Entity Framework for a while and looking at this code you can see that the creation of ListProject is basically repeated 3 times.
Is there any way to refactor this so I can reuse the d... |
I'm developing chess in python, and I've decided to make everything text-based before creating a GUI because it'd be my first time doing the latter. I haven't got around to the actual gameplay, but I've modeled the possible movement of any piece.
Note that I cannot implement En Passant and castling without turn data.
... |
I have looked around for an already existing script for this, but couldn't find one, so i decided to make my own.
The point of this is to make it easy to reload an element, whether its a form or a link.
To use the script, you add a class to the link/form called "js_container-reloader".
What the script does is it simply... |
The task
is taken from leetcode
Given a list of daily temperatures T, return a list such that, for
each day in the input, tells you how many days you would have to wait
until a warmer temperature. If there is no future day for which this
is possible, put 0 instead.
For example, given the list of temperatures T =... |
Given a text like "Hello World!" the program outputs the most frequent letter, in this case the "l".
If there are two letters with the same frequency, it outputs the first in alphabetical order, for example in the text "One" it outputs "e".
In addition upper and lower letters are counted as the same letter.
How could ... |
I need to create a customer and I have foreign keys for each table. Below is an image displaying the relationships of the tables when I want to insert a new customer. Then below the diagram I list out 3 methods that I would like to know any suggestions on how to best remove all the duplication. The main obstacle I enco... |
Given an input where we have two players: "X" and "O", and empty cells marked with a "." like:
check_winner([
"X.O",
"XX.",
"XOO"])
the program outputs if there are three "X" or "O" in horizontal, vertical or diagonal. If there is a draw it outputs "D".
def check_winner(game_result: List[str]) ... |
When testing or debugging applications it'd be often useful to be able to run it without certain features like committing things to the database, saving files, sending emails, reading files, executing queries and and and... Currently I use various configurations and boolean flags to achieve this goal.
This is a very t... |
Given an array of ints as input:
non_unique([1, 2, 3, 1, 3]) returns [1, 3, 1, 3]
non_unique([1, 2, 3, 4, 5]) returns []
non_unique([5, 5, 5, 5, 5]) returns [5,5,5,5,5]
non_unique([10, 9, 10, 10, 9, 8]) returns [10, 9, 10, 10, 9]
The code itself:
def checkio(originalList: list) -> list:
checked_list = []
res... |
I am working on this coding problem:
Count the number of words & lines that have more than X vowels for every Y words in every Z line.
Basically the input string has multiple lines and I need to count words that have X or more vowels in them. But the constraint is I need to consider only every Zth line as well as onl... |
I created a lexical analyser in Java recently, but I don't think the performance is very good.
The code works, but when I debugged the program, it take around ~100 milliseconds for only two tokens...
Can you read my code and give me tips about performance?
Lexer.java:
package me.minkizz.minlang;
import java.io.IOExcep... |
There are many APIs that require some kind of a string key/name. I usually try to avoid using raw strings and prefer to use helpers that can create them for me.
One such a tool is intended to be used with my FeatureService that requries feature names as strings.
Usage examples
In order to use it, I need a new set of ex... |
I am pretty new to C# and so i would like to ask you, how i could improve my code. I am currently coding a Visual Studio C# Console Game where you have to stack blocks. Currently you can only Stack 3 blocks because my code is getting really long and i am really losing my orientation.
The voids "Reihe1()", "Reihe2()" an... |
Given a sentence in 'bird language', where there are two rules:
After each consonant there is a random vowel added. For example if the consonant is "l" it will end as "la" or "le"...
After each vowel there are two extra vowels which are the same as the first. For example if there is a "u" it will end as "uuu"
Vowels ... |
I am new to developing in Python and would like to see comments about my word count solution.
Please indicate my mistakes or best solutions.
def count_words(text):
text = text.lower()
symbols = "1234567890!#$%^&*\"()_+=-{}[].,:"
for s in list(symbols):
text = text.replace(s,"")
text = text.split()
lst = ... |
In chess there are eight rows numbered from 1 to 8 and 8 columns a-h. Pawns which are on the lowest row are always in danger to be captured. The objective of the program is to calculate which pawns are saved.
Given the coordinates of seven pawns return the number of pawns which are safe.
For example:
safe_pawns({"b4",... |
I looked around for a script for popup menus in jQuery, but all i found were complex and largely-coded plugins.
I decided to write a small script myself:
$(document).on("click",".js_popup-trigger", function(e){
e.preventDefault();
//Set variables
var element = $(e.currentTarget).closest('.js_popup-trig... |
Introduction
I have created an algorithm that generates n! Sudoku Grids in poly-time.I verified the correctness of my grids with a SAT solver up to 50x50. I'm awaiting a review for improvements. It seems that it's in \$O(n^3)\$ time. I am saying valid complete Puzzles can be generated in poly-time, not solving arbitrar... |
This code is based off https://stackoverflow.com/questions/25711103/javafx-combobox-lazy-loading-images but modified to work with a TableCell
Firstly, the model object should have an observable File property which represents the image to load.
We need some background executors
ExecutorService exec = Executors.newCached... |
Given a word the program outputs the length of the longest substring with the same letters. For example:
long_repeat('sdsffffse') == 4
long_repeat('ddvvrwwwrggg') == 3
long_repeat('abababaab') == 2
long_repeat('') == 0
The code is:
def long_repeat(line):
substrings = []
current_substring = ""
for i, lett... |
I'm currently building an application that uses the same models in different controllers. Instead of using the normal way, being loading the model in the controller I've build a "core controller" (Foundation_controller) which can load models all other controllers extend from this controller in a way.
In those extended ... |
Given a string representing the hour and minute, where: 00:00 <= time <= 23:59, the program should output the number of angles the sun is above the horizon.
When time is "06:00" the sun angles are 0º
At "12:00" the sun is at 90º
At "18:00" the sun goes to 180º
After "18:00" and before "06:00" the program should output... |
I'm new to Dart and Flutter and I would like to know what do you think about this code and if it's any way that I could improve it :).
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget bu... |
What is this:
This is a simple function, part of a basic Monte Carlo simulation. It takes sample size and probability as parameters. It returns the simulation result (positive answers) plus the input parameters in a tuple.
What I'm asking:
I'm trying to avoid using temporary variables, I have two questions.
Do I reall... |
Question
Any way I can optimize this further with C++11 or C++17 features?
Would also like feedback on my variable naming, memory management, edge case handling (in this someone calling my function with an nullptr or int overflow with my rearranged equation to calculate the mid), and coding style. If there are other d... |
My FeatureSerivce provides only basic APIs, so it is good in dealing with single features. Like I can configure only one feauture at a time:
public FeatureService Configure(string name, Func<FeatureOptions, FeatureOptions> configure)
This might qiuckly get a lot of work when everything that has something to do with ... |
Given a string the task it to find its first word with some rules:
The string can have points and commas
A word can start with a letter, a point or space
One word can contain one apostrophe and it stills being a valid one
For example:
assert first_word("Hello world") == "Hello"
assert first_word(" a word ") == "a"
as... |
This is a Leetcode problem:
Implement pow(x, n), which calculates x raised to the power n (\$x^n\$).
Note -
-100.0 < x < 100.0
n is a 32-bit signed integer, within the range [\$-2^{31}\$, \$2^{31}\$ − 1]
def pow(x, n):
if n == 0:
return 1
if x == 0 and n < 0:
return
result = 1
if n >... |
I have a function to review which implements Stern's diatomic series fusc for a single word (ulong = unsigned long) in place, as a part of an arbitrary-precision implementation. In fact, there's just one part of it that's bothering me, though I'd be happy to get feedback on any of it, of course.
I have a (pseudofunctio... |
I'm learning about Python and am going through the OO-stage where I'm building a set of logic-gate classes.
To make the logic more resilient, I only want the user to be able to enter a value of 0 or 1 for the pin value in my binary class. I've currently done this by implementing a try/except in the getPin function, bu... |
This task is taken from Leetcode -
Given an unsorted array of integers, find the length of the longest
consecutive elements sequence.
Your algorithm should run in \$O(n)\$ complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
/** Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Theref... |
I have a python script, that is performing OCR on PDF pages.
I am trying to do so I can provide coordinates to the script - so it will only select the text within the provided coordinates (x, y, h, w).
This task in itself should be easy enough, however there is a caveat.
I am trying to do this on PDF files that are:
... |
What do you think about this code? Do you have some advices and remarks for me about them? I have started learning python recently.
types = {
"str": str,
"int": int,
"float": float,
"complex": complex
}
def my_input(kind, msg, msg_wrong, detail):
""" Add-in for input(). Performs validation of the ... |
I'm working on a framework which builds on .net core Identity. Let's say I wanted to extend the IdentityUser<TKey> class with a ParentUserId property while the developer should still be able to decide which type to use for the TKey primary key. This property would be a foreign key to another user, but could be null if ... |
I'm trying to get a better feel for how an entity-component-system system works. I'm most comfortable in JavaScript, so that's what I wrote it in. I'm mostly looking for ways my code violates ECS principles, but am also looking for ways to make my code more idiomatic.
class Component {
get type() { return this.cons... |
The Challenge
Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required.
For example, given [(30, 75), (0, 50), (60, 150)], you should return 2.
I believe this code has no errors but if you find any, please do let me know. Otherwise, feel free... |
I am working on creating a simple MVC inspired framework (for learning purposes and because i don't want to use a pre-existing framework at the moment). I have the system already set up and its working as it should, but i would like to have some feedback on the "view" part of the system, maybe i have set it up in a way... |
I am trying to solve this leet code problem
https://leetcode.com/problems/replace-words/
Please comment about performance.
In English, we have a concept called root, which can be followed by
some other words to form another longer word - let's call this word
successor. For example, the root an, followed by othe... |
Never really got past the beginner stage of programming so I'm trying to get better this Summer. I think games are a fun way to learn how to program so I decided to start with snake. I'd appreciate any feedback or learning resources you guys think might be helpful. Cheers!
How it Works
From the menu screen, when the us... |
I started writing a small CLI menu library in python. I'm uncertain of the structure and scalability of the current code. For example the Menu.choice method would grow very large if were to add more options for navigation input. Could this be better done with a class to handle the input?
import sys
import os
class M... |
I'm trying to think of ways to clean up this component in my app so it looks more readable to other devs. This is the best I came up with so far. It's not that bad, but I think it could be a lot better. What do you guys think? How would you clean this code up to make it more readable?
const DisplayTasks = ({ tasksArray... |
I'm looking for feedback or tips to maybe make my code more readable or faster or just general tips to help get myself started with app making with Python.
import sys
# check for valid input
if len(sys.argv) == 2:
try:
int(sys.argv[1])
if(len(str(sys.argv[1])) == 16):
pass
else:... |
I try to find the the better solution in terms of time complexity.
Among the list of elements I need to find the sublist with maximum value of given utility function.
Each element has it's own type. The type of the adjusted element in the sublist should be different
My code works, I find it not optimal. I guess there i... |
I recently started learning C, and this is my first fairly large (to me) program. It's a basic Tic Tac Toe game for the console. There's no AI, it's just a 2-player game. Is there anything I can improve?
Some problems I've been told elsewhere:
There's no case for tying/drawing.
I should split the place function into t... |
Given a string in a 24 hour format the program outputs a 12 hour format. The rules are:
The output format must be 'hh:mm a.m.' if it represents before midday and 'hh:mm p.m.' after midday
When the hour is less than 10:00 you should not write a 0 before the hour, example: '9:05 a.m.'
For example:
12:30 → 12:30 p.m.
09... |
The challenge
Given an array of integers and a number k, where 1 <= k <= length of the array, compute the maximum values of each subarray of length k.
For example, given array = [10, 5, 2, 7, 8, 7] and k = 3, we should get: [10, 7, 8, 8], since:
10 = max(10, 5, 2)
7 = max(5, 2, 7)
8 = max(2, 7, 8)
8 = max(7, 8, 7)
Do... |
I have a small program that removes subtrees of a tree based on following condition: If a subtree consists only of nodes with "rank" 1, remove it. I am using recursive DFS approach. Trees or subtrees does not have any further special properties. I want to ask about your opinions. Is it possible to make this more ele... |
This is the problem:
Write a function to create a table from CSV data.
The input to the function is a list of strings. Each string is
formatted as a CSV record. Here’s an example for a possible input:
Name;Street;City;Age
Peter Pan;Am Hang 5;12345 Einsam;42
Maria Schmitz;Kölner Straße 45;50123 Köln;43
Paul Meier;Mün... |
I would like to optimize the below code The only difference is the datatypes RadioButton, Label, and Button. Outside the method I have an loop that iterates over all the controls in the aspx-page. I have the limitation of .NET 3.5. The code is intended to set language relevant strings on the controls of a certain type ... |
I am looking for some feedback on my blackjack Python code. Any feedback is much appreciated. Docstring, code etc.
Other than that, I need to test it, and I am not sure how to make this code more testable. Any tips on that would also be appreciated.
from random import shuffle
class Card():
"""Class handles cards ... |
Enums with the FlagsAttribute have the disadvantage that you need to be careful when assigning their values. They are also inconvenient when you would like to allow the user of the library to add their own options. The enum is closed/final.
My alternative Option class should solve these two issues. It can be used eithe... |
I implemented a tree search with JavaScript.
It has below basic rules.
It will search over an array of objects which has recursive(like fractal)
If it found a according data in a leaf(the final depth one), it will return its ancestors, but without its siblings.(Example is below)
So here is an example.
Original one li... |
I was assigned this homework assignment to complete. The question originates from CodeStepByStep. Below is the prompt for the question:
Write a function stutter that takes an array of Strings as a parameter
and that replaces every String with two of that String. For example,
if an array stores the values ["how", "... |
This is my first Ruby gem that claims to provide all the rules of the chess game. My goal was to keep this library as simple as possible via OOP principles, and I'd be glad to hear any feedback from you. In particular, I'm interested in code organization and OOP issues
The source code and useful README can be found at ... |
I have an image class and a table class. To each image a single table can be "attached". Each <image, table> pair should be identified with an ID, which can later be used to get the pointer of image or table associated with that ID. Images in this "map" should be unique. Below is my solution, please let me know if it c... |
An assignment at school required me to write a Python program for this task:
In the matrix-chain multiplication problem, we are given a sequence of
matrices A(1), A(2), …, A(n). The aim is to compute the product
A(1) …, A(n) with the minimum number of scalar multiplications.
Thus, we have to find an optimal pare... |
An assignment at school required me to write a program for this task:
In the rod-cutting problem, we are given a rod of length n inches and
a table of prices p[i] for i = 1, 2, …, n. Here p[i] is the price of a
rod of length iinches. We have to find the optimal way of cutting the
rod so that maximum revenue can ... |
Recently I have answered another question about performance. A solution found using PowerShell-ISE successfully, and good speed testified using PowerShell Core.
However, running the same script(s) in PowerShell 5.1 displays utterly different results, absolutely worse in the performance improvement. Moreover, the origin... |
The task
is taken from leetcode
Given a list of unique words, find all pairs of distinct indices (i,
j) in the given list, so that the concatenation of the two words, i.e.
words[i] + words[j] is a palindrome.
Example 1:
Input: ["abcd","dcba","lls","s","sssll"]
Output: [[0,1],[1,0],[3,2],[2,4]]
Explanation: The pa... |
I have created a small static site generator (for learning purposes) in Javascript ES6, using Promises, but I am not certain of how to use them well. The code below works fine, but I wonder if i can't write my promises a better way.
I call my promises in SSG.start();
const yaml = require('js-yaml');
const fs = requir... |
Let me start by saying that until very recently procedural was the paradigm of choice for about 100% of my programming activity, and I was a complete stranger to C++ and OOP concepts. Since a few weeks ago, I have been studying C++ and today I decided to take some random procedural code and translate it to object orien... |
I have taken the code from a tutorial of Microsoft webpage.
Of course, the example is for illustration only but I wanted to organize it and make it clear in order to understand it a little more.
Here the link: https://docs.microsoft.com/en-us/windows/desktop/winsock/complete-server-code
It almost the same but structure... |
As the title states, this is my 4th revision of this class.
Here is the previous post if needed.
I'm hoping someone experienced with things such as noexcept, [[nodiscard]], etc can go over the uses in the class below any make sure I'm on the right track?
Further more, I've attempted to implement the copy and swap and w... |
This is a Leetcode 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 a sequentially adjacent
cell, where "adjacent" cells are those horizontally or vertically
neighboring. The same letter cell may not be used more than ... |
This is a Leetcode problem -
Remove the minimum number of invalid parentheses in order to make the
input string valid. Return all possible results.
Note -
The input string may contain letters other than the parentheses (
and ).
Here is my solution to this challenge -
def remove_invalid_parentheses(s):
re... |
I wrote this 2048 game using Python 3 and pygame a few weeks ago. Since I'm getting into CS this summer, I would like to get some review on how I can improve my code in generel. Any tips and improvements are welcome, and highly appreciated.
The code is found below:
import pygame
import random
class Main:
def __ini... |
I've tried to solve this challenge about 4 hours during the contest, but all my attempts exceeded the time limit. I tried to solve it with min-heap, but can't pass all the tests. How it can be solved within given time and space requirements?
Problem statement
Programmer Alexey likes to work at night and does not like ... |
During implementation and testing of different small hobby projects I often reach the point where I need (at least I like it more) some random data beyond the usual foo-bar strings or lists. Random here does not mean really mathematical random data but just something that looks random to humans.
Therefore I came up wit... |
I'm trying to optimize my solution to Wiggle Walk for Kickstart's round 1C.
Problem
Banny has just bought a new programmable robot. Eager to test his
coding skills, he has placed the robot in a grid of squares with R
rows (numbered 1 to R from north to south) and C columns (numbered 1
to C from west to east). T... |
An assignment at school required me to print all permutations of a string in lexicographic or dictionary order.
Here is my solution to the task -
from math import factorial
def print_permutations_lexicographic_order(s):
seq = list(s)
for _ in range(factorial(len(seq))):
print(''.join(seq))
nx... |
As part of the practice, I created minimalist linked list named SimpleList which can be iterated in two different ways: one element after another or by every second element.
Because I'm beginner I would really appreciate your opinion about my solution. Is it correct? What should I change?
public class SimpleList<T> : ... |
This is a Target number solution finder which I made with tkinter and is where the user enters a number they want and enters 4 other numbers to find the sum to make the number they want.
This is a screenshot on what the GUI looks like:
This is the code for the project:
from tkinter import Tk, Frame, Label, Button, Int... |
I made a function to get a list with numbers around another number. Example: I want to get in a range of 2 numbers around 4. This will return: [2, 6]. You can set a min number and a max_number. That means when I set a min_num, the lower number should not be lower than the min number.
import sys
def get_numbers_around... |
I've implemented a minimal external sort of text file using heapq python module.
On the few tests I did it seems to works well, but I would like to have some advice to have a cleaner and faster code. I do not know much of good practices and I want to learn (May wish to go from academics to industry one day). All remark... |
I'd like to know your opinions on this minimal type-checking decorator (with @ annotations) to make type checking of a method while debugging like :
def typecheck(*tuples, **kwtuples):
def decorator(func):
def function_wrapper(*args, **kwargs):
#print('tuples : ' , tuples)
#print('... |
Brief Description:
In my NodeJS Application, I have a model called User.
User.js
module.exports = {
attributes: {
name: {
type: 'string'
}
}
};
My application consists users searching functionality using name attribute. For that I used find users using exact name as below(I am using MongoDB as my D... |
I am using PostgreSQL 11.0 and I wrote a PL/pgSQL function to test if a word or phrase is contained within another phrase. This function is called several times within another function to extract some words from a paragraph. The execution of the calling function is slow, and I suspect it is because of this function:
CR... |
I came across a question asked here and here on the Crypto Stack Exchange site, and decided to analyze it as a kind of case study. To demonstrate the concept, I wrote a short python script depicting the proposed encryption scheme. It's mostly list comprehensions or generator expressions and bitwise operations.
$$C=E_k(... |
Challenge:
Return the length of the longest word in the provided sentence.
I've made a solution that works but it is kinda bad since the time complexity is \$O(n \log n)\$ and it involves mutation.
function findLongestWordLength(str) {
let strSplit = str.split(" ");
let wordLengthArray = [];
for(let i = 0; i < ... |
I'm integrating my app with a payment gateway, and have the following code which returns an array to populate the transaction info:
function populate_transaction_info($data)
{
extract($this->extract_model_data($data));
// set to empty array to ensure run-able code
$transaction_info = [];
return array_merge($t... |
I have an if-else statement in a php class, which works perfectly. I want to know if there could be an any better or faster way to accomplish this?
<form method="post" action="">
<input type="text" name="value_1" value="" ><br>
<br>
<input type="text" name="value_2" value="" ><br>
<br>
<input type="submit" value="su... |
I am a complete beginner when it comes to programming and writing games and this is my first ever game. I made it with python 3 using pygame library. I would appreciate any feedback really.
from __future__ import annotations
from typing import Tuple, List
import pygame
import random
import sys
# screen width & heigh... |
Our teacher doesn't give much feedback on our code itself. Was just looking for some feedback on how I could improve on this. This is the method that tests the string against the Turing machine that is built from a file.
The entire project is on GitHub.
public boolean run(String input) {
String currentState = start... |
HTML / CSS Slider. No JavaScript.
Wanted to make an all CSS Image Slider. Though there are plenty of pre-made options setup a lot seem clunky or add a lot to load time. Have ideas for some more detailed ones, with and without JavaScript, but wanted to make a basic one first and get any feedback.
CodePen: https://code... |
I have a program which, at its core, involves repeatedly performing an action on some value, and based on that action also returning a list of new values to perform that action on. The pure version of my function is:
recurse :: (a -> [a]) -> a -> [a]
recurse f a = a : concatMap (recurse f) (f a)
Which can be used for ... |
To practice my JavaScript for future employment, I've decided to take up the challenge of writing a javascript sudoku verifier. This code only verify's one of the nine 3x3 blocks there are. I would like feedback on this portion of the code, so I can continue my development with more knowledge and more efficient code. A... |
This is a Leetcode problem -
A city's skyline is the outer contour of the silhouette formed by all
the buildings in that city when viewed from a distance. Now suppose
you are given the locations and height of all the buildings as
shown on a cityscape photo (Figure A), write a program to output the
skyline for... |
Posted my first attempt at Tic-Tac-Toe a second ago here. Got a lot of great and helpful responses. The main things I took away from these responses was to use spell check, and to keep things simple. Wanted to give it a second go before moving on to something a bit bigger.
Learned about the Minimax algorithm from this... |
I'm building a clone banking app at the moment, and one of the things I'm trying to do is add Split Transaction (which can then be shared with a set of friends paying a given amount each).
Initially, the transaction is split equally amongst friends (unless it doesn't split equally, in which case the remainder gets adde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.