instruction
stringlengths
71
71.9k
This function returns a lambda expression based on the parameters sent. I am sure there is a better way to do this. [NonAction] private Expression<Func<ScheduleItemDto, bool>> Where(Guid siteGuid, Guid? eventGuid, MonthOfYear month, int year, bool? closed) { Expression<Func<ScheduleItemDto, bool>> n...
I created an Excel AddIn that has a function called SLOOKUP which can replace INDEX MATCH combinations in an easy and smart way. For more info please visit my blog post. I would like you to optimize this further if possible. Function SLOOKUP(database As Range, lookupCol As Range) ' Description: Excel UDF that implemen...
Please review my answer for this interview question: Merge k sorted arrays, using min heap. import java.util.*; public class MinHeap{ public static class HeapItem implements Comparable<HeapItem>{ int[] array; int index; // the index of current element ...
If I'm creating an immutable class from an existing class, should I override methods that mutate the property or have an instance of it and write my own methods to read from the property? I have an existing class Set which is basically a fancy array. There's a few more methods in the class but for the purposes of this ...
I didn't write the login code yet. Main static AccountLogin objAccountLogin = new AccountLogin(); static AccountRemover objAccountRemover = new AccountRemover(); static AccountCreator objAccountCreator = new AccountCreator(); static Accounts objAccounts = new Accounts(); public static void main(String[] args) { ...
I have some functionality that allows the user to create a Meter, which counts your gas, water, and electricity usage. A Meter has one or more Counter objects, which keeps track of your usage for a certain date via CounterReading. Once a Meter is created, you can edit it by adding a new Reading. This is the caller: Cre...
I made this Primitive class recently for my OpenGL engine. It basically wraps all basic primitive shapes, like cones, toruses, and cubes, which the user can use for various things. I would like to ask your advice on improving my class design in any ways. Primitives.h: #pragma once #include "alpha/Mesh.h" #include "alp...
Select one of two number selection strategies and select two numbers using that strategy. The strategy is selected using an enum implementation of the strategy pattern. Strategy one: Ordered Numbers are selected sequentially. The last number selected is persisted in the database and the next two numbers are se...
Problem Statement: Samu had got N fruits. Sweetness of ith fruit is given by A[i]. Now she wants to eat all the fruits , in such a way that total taste is maximised. Total Taste is calculated as follow (Assume fruits sweetness array uses 1-based indexing) : int taste=0; for(int i=2;i<=N;i++){ if (A[i]-A[i-1]...
I wrote up a Treap implementation to serve as the base class for a bunch of augmented data structures (interval sets, plane (2D) sets, order statistic trees), replacing my RB-tree base. Some profiling for performance compared against std::set: 4 times faster insertion (for all cases; random, in order, reverse order) ...
I'm currently learning Java. I'm trying to get a good grasp on determining what becomes a class. I've started translating old games in to simple Java programs. I'm looking for any critique of use of objects. Pretty much any advice as to what could make this better in the long run. (This code has no input error c...
I have this script which is for a news feed. A button click will grab more data from the server if there is any and then add it to the box. It doesn't allow any more than 10 pages of results currently and how to properly store that page counter is what this question is about. loadMoreFeedItems() is the function attach...
So I've been confronted with a rather simple problem in the Java chat on Stack Overflow. It's about doing a median filter with a sliding reference window. For the purpose of the task we can assume the window used for filtering is always an odd integer between 3 and 21. The sliding window does not wrap around the array ...
This is my revised solution to Problem 42 from Project Euler, based on suggestions in this original post Project Euler 42 - Finding triangle numbers using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Collections; using System...
Since I was having some difficulties to debug the next step for Scrolly - A (very) simple infinite mouse "scroll", I've decided to make a console-like class that allows to add messages to it. This allows you to show some messages. It also allows to pass any object you want, but it will be converted to string. You can a...
This question is a follow-up. The original question was itself a follow-up to an older question by @LokiAstari. The idea is to provide a compile-time integer range. This version incorporates almost everything from the answers and comments to the previous iteration of the review (except the handling of corner cases s...
This is the answer to this challenge: Description Thanks for that list you made me, my thoughts are way more organised! I've got a few problems though that I thought you might be able to help with? Sometimes I put the wrong information in a list item. Maybe to prevent this I'd be able to modify/update the list item? T...
I have implemented an Integer to Roman Numeral converter that converts any number in the range \$[1 \le x \le4999]\$ to its Roman number equivalent. Any comments on improving my code style or organization? #include <string> #include <iostream> class Solution{ public: Solution () : IntVal {1,5,10,50,100,500,10...
I recently started toying with SIMD and came up with the following code for matrix multiplication. First I attempted to implement it using SIMD the same way I did in SISD, just using SIMD for things like the dot product for each particular entry, which was actually slower (still trying to figure this one out). After gi...
I wrote a Perl script that implements the algorithm described in this article to generate terrain height maps. The idea is to raise a random hill \$i\$ of size \$r_i\$ centered at point \$(x_i, y_i)\$, such that the height at point \$(x, y)\$ is $$ z = r_i^2 - ((x - x_1)^2 + (y - y_1)^2) $$ The resulting terrain is th...
In an attempt to learn better functional programing I've attempted to convert some Python to idiomatic Clojure, but I'm not sure how well I did with parts of it. One thing I found myself doing a lot was destructuring a map into a list and then converting it back into a map as in the following example that takes a map o...
This program detects whether an expression is balanced or not. I would like to know how I can make this more efficient. #include<stdio.h> #include<stdlib.h> struct Stack{ char data; struct Stack *next; }; void push(struct Stack **top,char data) { struct Stack *new_node; new_node=malloc(sizeof(struct S...
Both of the following code give the same result. But I'm not sure where should I put the raise statement. def bisection(f, start, stop, eps = 1e-5, max_iteration = 100): for __ in range(max_iteration): half = start + (stop - start)/2 if abs(f(half)) < eps or half - start < eps: return half if f(ha...
I'm trying to create a program that converts infix expression to postfix (using stack) and evaluate the result of the postfix expression. I already have a solution that works, but I feel that it's ugly and that there must be a better approach. (Note: the program must be able to accept digits greater than 9 and decimal ...
I've implemented this skip-list yesterday, and I'd like suggestions on how to improve this code, and my coding practices. import java.util.ArrayList; import java.util.List; import java.util.Random; public class SkipList<T extends Comparable <T>> { List<Node<T>> levels; public SkipList(){ this.levels ...
I have refactored the graph path enumerator. DirectedGraphNode was not changed, so refer to the link above in case you want to have a look at it. The node type is not of a big concert for me, however, I just need something to find paths through. Now, all five points made by Misha, except the second one (deferring the p...
I am developing an online game and my code is getting pretty hard to work with. I would appreciate any suggestions how to clean it up or make it simpler to work with. Thanks for any suggestions. import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import serv...
I made an animation of the Microsoft logo. It's available as a CodePen doodle, also. Would anyone be so kind as to check my style and say if there is anything I could've improved? (I am sure there is.) $(document).ready(function(){ $(".logo").click(function(){ $(this).toggleClass("turnOffAnimation"); ...
I am using C++ to code the following logic: An Array is given we have to traverse the array such that sum of array elements to its left must be equal to sum of elements to its right. BTW this is hackerrank Problem. Here's the code , but this is giving me time-out, that is my code is too slow for very large input, I w...
I created a method for finding the most common character in a string (using HashMap): public static char getMaxViaHashmap ( String s) { HashMap<Character, Integer> map = new HashMap<Character, Integer>(); char maxappearchar = ' '; for (int i = 0; i < s.length(); i++) { ...
The task: There is an AccountManager that makes transfers. It receives 2 arrays of the same size: accounts and sums. They need to be transferred to the accounts correspondingly. public interface AccountManager { public boolean transfer(Account[] accounts, int[] deltas); } There is also an Account interface: public...
I'm writing a Python parser for OpenFoam mesh files. When the mesh is big, I face performance issues. Here is the format of the file describing the points: /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\...
I wrote an STL allocator which uses boost::pool to allocate the memory for std::vector container. This is my first time I implement an allocator and while working on this class I found that STL containers (std::vector for example) copy, destruct, create many times the assigned allocator during their lifetime. For examp...
This is my program currently to calculate sum of following series: $$\frac{x^2}{2!} + \frac{x^4}{4!} + \frac{x^6}{6!} \dots$$ #include <iostream> using namespace std; int main() { int fac = 1; float x, sum = 0, p = 1; cout << "\nENTER x: "; cin >> x; p = x; for(int i = 2; i <= 10; i++) { ...
At the moment, it gets the first page worth of data and then each subsequent page when the user scrolls down to the bottom of the page. My JavaScript/jQuery level is fairly weak, however I have managed to cobble this together and would like to know how I can improve my code. var page = 1; $(function() { getUser...
I've found that it's a huge pain to have to write the boilerplate code for each Project Euler problem I write (timing code, main method, what about running every problem instead of just one?). So I decided to create a program to run the problems for me. Main.java package projecteuler; import projecteuler.autorun.Execu...
I'm currently going through some lessons on Codility. I've just spent a couple of hours with GenomicRangeQuery, which is intended to demonstrate the use of prefix sums. The task description is here. Broadly, the idea is that given a string and a set of arbitrary cut points one should be able to return the lowest value ...
See also the next iteration. This snippet is a counting Bloom filter supporting removal of elements as well. Instead of a bit vector it maintains a vector of "bucket counters". Also, the API supports well taking your customised hash functions. Inserting: Just compute all hash values and increment all counters indexed b...
I'm starting C as my first language and am just under halfway done the book I'm using. However, I commonly hear about 'bad' programmers and 'bad' code whenever I encounter any sort of programming related discussion on the internet. I've done some examples that do work as they should but, I want to make sure that when I...
I'm trying to do a recursive implementation of the problem mentioned below. The code works, and takes care of a corner case with only 1 element in array (in which case I should return 0 - (element[]). Could there be improvements to this solution (like say not having to pass 4 arguments or anything like similar). Also,...
I have written the following class to allow me to uniquely identify classes in C++, and I was wondering if there are any better ways of going about it. #ifndef _TYPE_IDENTIFIER_H_ #define _TYPE_IDENTIFIER_H_ typedef std::size_t Identifier; class TypeIdentifier { public: template<class T> static Identifier get...
Firstly, I got the solution for this question in CodeChef, but I noticed one thing which still confuses me. This was the code which was accepted as correct. #include<iostream> using namespace std; int main(){ int testCases,count=0; cin>>testCases; unsigned long int a,b; while(testCases--){ c...
I have made an implementation of the Euclidean algorithm in Java, following the pseudocode shown below. As far as my knowledge goes, I can't find a way of making this more efficient. I have looked into other peoples implementations of this algorithm and there are a few which are slightly shorter, and some that use recu...
After reading Designing a coffee machine, I decided to implement the same problem as an exercise to get to know Guava and Lombok. I used the problem statement from the given question: Design a coffee machine which makes different beverages based on set ingredients. The initialization of the recipes for each drink sho...
I have a program which solves Project Euler problem 60: The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowes...
I'm reinventing std::future from scratch (for an upcoming talk). I'd like to incorporate as many of the latest and most likely-to-succeed proposals as possible, and then also at least one additional feature that I haven't seen in any proposal yet: cancellation of tasks. The idea is that if I spawn a chain of tasks via ...
I made a commandline tool for renaming files, similar to the rename command in Ubuntu. Here is the code: import scala.collection.mutable.Map object Main extends App { val usage = """ |A commandline tool for renaming files (written in Scala) | |Usage: | | screname [-a] [-t] -s searc...
I have an array to have a maximum of 10 elements. Whenever I add a new element, if it already has 10, it would remove the first and push a new one. I made this: Array.prototype.pushMax = function(value,max){ if (this.length >= max){ this.shift(); } this.push(value); } Which seems to work fi...
Folow up of diary-applications-with-accounts Diary Class AccountLogin objAccountLogin = new AccountLogin(); AccountRemover objAccountRemover = new AccountRemover(); AccountCreator objAccountCreator = new AccountCreator(); Accounts objAccounts = new Accounts(); Exit objExit = new Exit(); public static void main(String[...
This is my solution to Project Euler #4, which asks for the largest palindrome that can be made from a product of 2 3-digit numbers. I have done a brute force method, but it takes around 10-20 seconds to run. It works by looping through 2 variables, finding its product, and converting it to a string to check for palind...
I made what started out as a web browser but now is a scanner for open ports. I wanted to know if you think this is a realistic or a unreliable tool for port testing. I found some open ports on my computer and was able to send data through them. #include <windows.h> #include <winsock2.h> #include <conio.h> #include <st...
My attempt at this challenge., incorporating lessons from this question, which turned out into a much bigger project than I anticipated, but it works. I'll definitely be refactoring most of this in the future, maybe going the MVC route. I tried a lot of new things here and am curious which are good and which are far re...
As part of a larger Java application I'm working on, I have to retrieve emails and parse the data for the emails' content (subject, date, text, attachments, sender). In the method below, I pass a Message as a parameter, which is the Javamail abstract representation of an email. The details of the Message are recovered ...
I'm creating a WPF application with a DataGrid. I'd like some advice on the code I've written: <DataGrid Margin="0,10,10,10" LoadingRow="DataGrid_LoadingRow" Name="user_view" EnableRowVirtualization="False" Grid.Column="2" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" CanUser...
I have written a simple program in Java 7 to write the .gitignore of different file types: import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Scanner; public class Oye { private static final String HELP_TXT = "help.txt"; private static final String DATA = "gitignore"; ...
I'm working on a 3D-project with three.js and webGl. I've written a function to check for 2 objects to be near each other and thus "snap" to each other. The objects don't move on the Y-axis, so I only have to check the 4 sides of each object against the side of all other objects in the scene. At the moment I'm doing th...
We are using an outdated 3DES algorithm for encryption and I have been tasked with writing a new implementation using AES with a 128bit shared secret. I would like to know if there are any security holes in my implementation and if there is any way to optimize the code. Please note that I have removed the code for impl...
I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is from Controllers (Activities) to a "Manager" class that handles all the subscriptions. Here is an example: Controller Class public abstract class EventBusActivity extends Activity { protecte...
The problem: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? The solution in Swift: import Foundation var number = 2520 var found = false while found == false ...
I previously asked about my implementation of the Sieve of Eratosthenes algorithm here. After looking at all of the feedback, I have reworked the code to make it significantly more efficient. However, I'd like to know whether it can be made more efficient still. I have tried to follow pesudocode for my implementation, ...
I have the following code which duplicates the previous input if any entry is less than zero or NaN, except the first row of a matrix. Is there any other efficient way to do this without using multiple for loops? The input matrix values may differ in some case and may contain float values or alphabets. The matrix cons...
I’ve made an e-commerce website where administrators can specify the number of deliveries they can make on any one day. I’ve written a SQL statement that then finds all delivery dates, finds any matching orders on those dates, and then returns any where the remaining “slots” are greater than zero (i.e. available). The ...
I have been working on a calendar widget for the past hour or so. I wonder if it could be compacted any more than it already is (ignoring whitespace). $(document).ready(function() { var d = new Date(); var cd = d.getDate(); var cm = d.getMonth() + 1; var cy = d.getFullYear(); var M = cm; var Y = cy; va...
I have been given a requirement to create a symbol toolbar, a toolbar where each button represents a unique symbol. This is how the toolbar would work: A user clicks inside a text field and enters data. The user would then click a symbol on the toolbar and it will be appended to that specific text field. The browser ...
This class allows for easy management of the KeyboardState of an XNA game. It provides a simple, easy-to-use API for interacting with the Keyboard and getting key-presses, via a few (trivial) events. As far as I can test, it works as intended. GitHub Link (for future reference) as of this version: KeyboardStateManager....
I have the following code: public final class PropertyFileLoader { private static final Logger logger = LoggerFactory.getLogger(PropertyFileLoader.class); private final String propertyFileName; public PropertyFileLoader (String propertyFileName) { this.propertyFileName = propertyFileName; } ...
Due to some constraints I had to manually parse an HTTP response coming out of a stream. I could not use buffered reader or scanner because the perform buffering and end up buffering bytes beyond the response header itself. I'll be hitting my AWS S3 and only expect 200 or 206 status response. This seems to work, but I...
I was inspired by this answer and decided to implement an AVL tree with the methods equals and hashCode as if I was asked to do that at a job interview. This is my code on GitHub. In addition to the solution itself, I wrote tests for all the possible cases. If I missed something, or if my solution has any bugs, please ...
I have the following that loops through a range. When the initial value is found on the second sheet it goes to the cell to be able to compare some date values on the same row. Once the comparison is complete another value from the same row is copied to be placed back onto the first sheet. I believe the Application....
The task of this project was to create a method that takes in an array of stock prices, one for each hypothetical day. From there, the method should return the best day to buy and the best day to sell the stock to maximize return. A few ground rules: Stocks need to be bought before they can be sold It is possible th...
I am using this code to display all the permutations of a given input string. Any advice/solution will be very helpful. #include<iostream> using namespace std; /* Function to swap two characters */ void swap(char& a, char& b) { char temp; temp = a; a = b; b = temp; } /* Function to obtain permutations of string c...
My code reads in the data using DictReader, then creates a header row that contains my composite key (PEOPLE_ID, DON_DATE), and then adds various values that are distinct to each section. The output looks like this: -01- PEOPLE_ID, DON_DATE, etc... -02- dataline -02- dataline -01- ... etc... I'm looking to possibly s...
I have implemented an upgrades system in my Unity3d game, and I am pretty sure that I am not doing things in an optimal way. Any advice regarding best practices would be much appreciated. The idea is that when the player collects a powerup, their run speed and jump speed increases. Collect enough powerups, and you can...
I have made some simple functions to find the first SO chat message. How can I improve my code? Even if there is a stackoverflow link that will get the job done (I'd be glad to know), I'd like to improve upon my already written code. import Network.HTTP import Text.Regex.Posix type UserID = String type MessageLi...
The chart data is stored in a nested dictionary struct @line_charts, and I need to convert the prices to target currency with the function exchange_datasets_currency. It should finally return the @chart in the end of method. Is there any way to improve my pattern? def sample_a @line_charts = [get_line_chart(@from, ...
This code returns true if the sentence is a palindrome, and false otherwise. Is there a better way of doing this? def palindrome?(sentence) array_stripped_sentence = sentence.reverse.downcase.delete('').split('') array_stripped_sentence == sentence.downcase.delete(' ').split('') end puts palindrome?("Never odd ...
I'm building a HTTP API and this part should return a JSON list of posts and their attached photos, like this: [ { "id": "788", "content": "Foo bar! Foo foo, bar bar.", "photos": [181, 282, 182] }, ... ] And this is my PHP code handling the request: // get all the posts and their ph...
I started coding in Scala some time ago, and also learning some fundamental algorithms in CS. Here's a terribly slow implementation of Kosaraju algorithm to find strongly connected components in a graph. I'm looking for three things: Learning how to use Scala data structures Learning how to implement this algorithm in...
Here is a small code snippet I wrote that I feel is pretty naive. I copied the code directly from my project and renamed some ID/class names. I'd like to know how you could help to improve/refactor the code. radiobox1 and radiobox2 form a pair, and radiobox3 and radiobox4 form another pair - they're both mutually exclu...
I have an image which I know the number of rows and the number of columns. I would like to calculate the limits of the new image after a rotation. BufferedImage myImage = ImageIO.read( new File( "D:\\Users...jpg" ) ); xmaxOrigine = myImage.getWidth() - 1; ymaxOrigine = myImage.getHeight() - 1; angle = 12...
I had the idea to have a static method on an activity which creates intents that it can use. For example if I have an activity with a webview that can load html from a resource or a URL I would have 2 methods in the activity like so. public static Intent createURLIntent(Context context, int titleId, String URL) { I...
Is there a better way to implement a binary search than I am in my code? My function is taking two two lists - first_booth_voters and second_booth_voters with second_booth_voters being sorted and first_booth_voters not sorted. I feel like I am making an unnecessary amount of comparisons. from classes import VoterList ...
I am experimenting with making my own re-usable libraries. Therefore, I decided to start with some of the plots that I generally use during development/debugging to check what is actually inside my data. My questions therefore are: Would this be the correct way of writing a library? Are there any pieces of my code tha...
I am new to programming and I am trying to make a simple unit converter in python. I want to convert units within the metric system and metric to imperial and vice-versa. I have started with this code and I found this method is slow and in-efficient, How can I code this more efficiently? import math import time """Unit...
I made a simple routing class that I like to get reviews for, mostly because I do not know how to make it SOLID, since I even made this class separate from the HTTP response/request for the sake of SRP. All this class does is route-specific, which seems like solid enough to me. The actual library can be found at fastp...
After the feedback for my last script, I realized I should be using functions and trying to adhere to the style guide. I tried to do that here, though still very beginner. The rounding in Python confused me a bit, and originally the program got stuck for some numbers when the range narrowed down to 1. I think it should...
Every piece of business that gets written (E.G. an adviser's client puts an additional £10k payment into a pension plan) goes in a spreadsheet called the SubSheet. It's split into 8 worksheets for different kinds of business, each with lots and lots of columns. E.G. "Adviser" "First Name" "Investment Amount" "Commissio...
This is a contest problem; Description: In the winter, children started to build snowmen. The snowmen were becoming adorable, except for a detail: none of them had a nose. The king, touched, decided to give some of his carrots away so they could be distributed in rectangular-shaped regions of the Town. But the childre...
Here is my solution in Haskell for the Euler problem #101. It relies on building a specific base of polynomes given the values we want to fit (memories of my linear algebra courses from a long time ago). The algorithm is quite fast but as a new Haskell programmer, I'd like your opinion on what could be done to improve ...
I created this function that allows you to declare a string, then multiple instances of a substring. This uses a hash map to keep track of strings that have already been searched for and upon each call of its returning function will give you the next instance of that substring. I'm wondering if there's a way to do this...
I've written a password encryption algorithm in PHP, which (I think) is not very vulnerable to rainbowtable attacks. It's just that I don't have a lot of experience with encryptions, nor PHP. But from the knowledge I have I think this is a hashing algorithm which automatically adds salt, but I actually have no idea if ...
The purpose of these two classes (and hence why I am including them together) is to allow you to create a Camera, that indicates a "render zone", and track an object in this Camera, so that when the Position of the ITrackableObject changes, the Camera.Position changes to reflect that. Ignore the unimplemented Camera.Ce...
I have an array vs.tags which may contain hundreds of objects, and a smaller array coloredTags which only contains up to 3 objects. The goal is to efficiently check the ids in coloredTags to the ids in vs.tags and perform some action. This is what I have so far: var coloredTags = ColoredTagFactory.retrieveColoredTags()...
I wrote this recursive function to get all constants from a class and its subclasses. Can it be simplified? private static IEnumerable<FieldInfo> GetPublicConstants(Type type) { var subtypes = type.GetNestedTypes(BindingFlags.Public); foreach (var subtype in subtypes) { foreach (var constant in Get...
Everyone knows "99 bottles of beer on the wall". Mat's Mug made a comment about mugs on the wall in The 2nd Monitor and I realized I never wrote a "beer on the wall" program. But that seemed way too easy, so I made it a "n number of x on the y" instead. It also seemed like a good excuse to use templates in Python, whic...
I wrote a little bit of code in JavaScript that takes an array of objects and does some sorting, then outputs to an HTML page. I set a goal to do it without any frameworks, and in functional style on purpose to learn vanilla JS. It would be nice if someone could highlight any bad code or bad practice, and how I could i...
I have just discovered the beauty of prepared statements in PHP and how they protect against SQL injection. In my first time using them, I am attempting to grab a hashed password from a database and seeing if it matches up against the password the user inputted into the login form. Is this the most efficient way to: G...
When looking at people you may know on LinkedIn (requires you to be logged in) there are sometimes some annoying boxes that are for people who are email contacts but not on LinkedIn. I don't want to see these. If I wanted to connect with them and invite them to LinkedIn, I would have. So I wrote a userscript! I wro...
The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953. Which prime, bel...
As part of a larger project I'm working on, I've made a function that aims to replicate, as best as I can, the placeholder part of the console.log() function usable in most browsers. It replaces %s, %d , %i , %f and ,%o. It works by having 'unlimited' parameters (the replacements), looping through the parameters, check...