instruction stringlengths 71 71.9k |
|---|
I need to write a function that searches the two-tier board according to certain parameters, which works, but I question whether there is a simpler, lighter way to perform this task.
<?php
function findValue(array $array, array $parameters, $multipleResoult = false){
$result = array();//used when $multipleResoult =... |
Could anybody have a look at my HTML code and tell if it's build upon the correct semantic way using the right tags, and not using unnecessary divs?
I'm still not sure if there any divs in my code which don't need to be there.
.main-club-bar-music-festival {
overflow: auto;
}
.main-club-bar-music-festival h3 {
... |
I've been working on this login screen logic.
It checks for the parameters in the JSON response to decide which action to follow. It works but it's kinda ugly and verbose. Any suggestions to refactor to make it look more elegant and simple?
Alamofire.request(apiLink, method: .post, parameters: parameters, encoding: ... |
I've done a test for a job (which I failed) and I'd like to know in which ways my code could've been better.
Here are the questions and my answers, it's not very long.
1) Make a program that checks if a string has balanced parentheses or
brackets.
Braces: (), [], <>
For every closing brace, there must've been an op... |
I wrote this script and it's working quite well however I think there's too much if else statements on it. How could I change them for a switch statement?
@IBAction func sendLoginParameters(_ sender: UIButton) {
if correoTextField.text?.isEmpty == true && contrasenaTextField.text?.isEmpty == true {
let ale... |
This code is meant to sort a list of integers in place using quick sort.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
def quicksort(l):
quicksort_helper(l, 0, len(l)-1)
def quicksort_helper(l, lo, hi):
if lo >= hi:
... |
I've written a Pyspark program that will completely solve a tiered board game (no loops, each game position is a member of only one tier) and writes each tier to a file. It also determines the remoteness for each position, the distance to an end game state, where a winning position wants to reach an end state ASAP and ... |
For a tilt maze general reference, you can refer to this example. The previous related code review discussion could be referred here.
The problem I want to resolve is to find all possible path (so that in the future I can find minimal path) from source to destination.
My major idea is:
Represent the maze by flag which... |
I have a class with multiple methods which return a URL string of an API endpoint. Each method takes different parameters based on what the endpoint have to include.
Examples (among others):
GET: http://api.mydomain.com/v1/shopping_lists/items/categories
GET: http://api.mydomain.com/v1/shopping_lists/items?last_sync_d... |
I've been thinking my posts aren't that great, and so I've been wanting to improve them.
One sure fire way to do this is to look at all of my downvoted posts.
Not knowing if Stack Exchange allows you to do this already, I decided I should learn SQL, and wrote a SEDE query.
The query, downvoted posts by user, takes a si... |
I have never worked with Ruby before, and thought I'd start working on learning it. For my first little implementation, I have created a simple fraction class. It would be nice if someone would check what I did wrong or could improve upon. I am coming from a JavaScript background which is classless for the most part wh... |
I have 5 (or more) instances of an application running on same or different machines. Each of these application will pass a comma separated string of UserIDs and the app should pick up a unique unused record (UserID) from a DB table, matching the user IDs as passed through the SP.
So if App-1 picks User-3 and marks it ... |
I've made a Collatz Conjecture sequence calculator and I would like some feedback on what I can do better in regards to the code I've implemented, i.e. bad practices you see, improvements that can be made to make it faster, errors that might arise from this code that I am not managing, etc.
public static void CollatzCo... |
Please note: I have a follow up question with updated code, here.
I have written a file-copy routine, as I experienced unreliable results using standard Python when copying file over very slow networks.
The requirements are as follows:
to be used on Windows only
not to be limited by the 256 character limit of Windows
... |
Right now I'm finishing my very first web application, and I will buy my first domain name in my life shortly. My project is about a personal website that I'm going to upload every application I program on it. Right now I only have an accounting system and a program used by the market researchers.
The PHP file that I n... |
So I have a file containing a huge list of sentences, some containing keywords, and some not, so in order to specifically focus on the ones with keywords, I used this method. It works, but is there another way to this without having to create a new file?
keyW = ["love", "like", "best", "hate", "lol", "better", "worst",... |
The application is designed to read in class results of individual students from a single text file, and then manipulate the data to give information such as class mean, median, max, min, individual student averages and updating the result file if need be.
The format of the text file for each student is as such:
2 ... |
I have written my own deque class to get a better grasp of C++ pointers and memory management. The following code is part of a larger 2D isometric game I am developing. It compiles and runs fine using MSVS express 15.
I have provided a unit test source + output. I am fairly sure there are no memory leak issues (using ... |
I am trying to implement a singly linked list. What is the most optimal way of implementing a RemoveBefore(ListNode) method?
I have done this:
Check if node being removed is the head. If so, return.
Check if there are two nodes and node being removed is the tail. Then set head and tail as the same. Old tail will be au... |
I'm doing some programming challenges over at CodeEval and came across a pretty straight forward simple one:
Given numbers x and n, where n is a power of 2, print out the smallest multiple of n which is greater than or equal to x. Do not use division or modulo operator.
So the input looks something like this: 13, 8 f... |
I've been toying with this idea for quite a while.
Needless to say that this really enables a lot of possibilities,
Especially when combined with a SignalR Backend.
Added below is what I came up with. Would love your input!
EDIT: I know that this code has a "vulnerability": the cursor or its source must not be used out... |
When giving away or selling a PC, one should be careful not to send personal data with it. I'm in such a situation and was using dd if=/dev/urandom of=/dev/sdb bs=8M, but it was only averaging 22MB/s. Way too slow since I have to drop it at the post office next morning. So I decided to write my own and see what kinds o... |
The function tokenize generates tokens from a mathematical string.
It can chain characters together to form longer tokens.
This can be used to build a parse tree, in order to evaluate the math expression.
def get_char_type(char):
"""
Returns a string denoting the type of char.
>>> get_char_type('x')
... |
I am trying to build a function to find the highest number in a list without using the built-in functions of "apply" and "max".
I created the following code:
(define (highest-num lst)
(define (iter lst accu)
(cond ((null? lst) accu)
((< accu (first lst)) (iter (rest lst) (+ accu (- (first lst) accu))))
... |
I've written concurrent queue based on std::queue.
#include <queue>
#include <shared_mutex>
#include <condition_variable>
template <typename T, typename S = typename std::queue<T>::container_type>
class concurrent_queue {
// no std::shared_mutex yet
using mutex_type = std::shared_timed_mutex;
public:
expl... |
I need a function to determine whether or not a string has HTML in it or not so that I can know whether I'm dealing with a plain-text format or HTML format.
It seems simple enough in C#, using HTMLAgilityPack. Recursively go through the tree of nodes, and if any are an element node (or comment too) then we say "Yes, ... |
I wrote this code where I have to rotate an array of 'n' elements by 'd' elements in the anti-clockwise direction.Can it be done in a better and simpler way?
public class RotateArr{
public static void rotate(int[] arr,int d,int n){
System.out.println("Array before rotating : ");
for(int l=0; l<n; l++){... |
Last night in The 2nd Monitor there was a discussion about postless users - I wanted to see how many there are, whether they're one-timers that showed up once, registered and never came back, and whether they vote at all.
So I whipped up this query on SEDE, showing voters and their post count, as well as other informat... |
My original deque implementation and efficiency question lacked move semantics. After ratchet freak provided an example of how to define them I decided to try adding them to my deque. The unit test + output below shows that the code is working.
However, my new question is: Are there edge cases in any of my move semanti... |
This code is meant to implement a hash table class which uses linear probing.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
class Hash:
def __init__(self):
self.size = 11
self.vals = [None] * self.size
... |
When I have to write a report or an article, I usually have my bibliography as PDFs in a specific folder, so I wrote this script to automate the generation of bibtex entries.
It works so far, but I'd like to have suggestions about what I could improve
#!/usr/bin/env bash
FOLDER=$1
BIBTEX_FILE=$2
cd $FOLDER
for f in *... |
This is my contact.php file which has only 2 functionalities:
Response with the default page if it is requested by the get method
Process the message posted by the client if it is requested by the post method
It didn't designed to process any ajax or any other request, just the "get the page" and "post this message" ... |
I created a program for a college class. After I got it working, I wanted to improve it. As a beginner, it is probably a mess.
Description
It uses a HashFunction and a HashTable and quadratic probing for collisions. It will tell the user to enter a word and after that will check if that word exist in any of the 3 text ... |
I am working on a project for a Raspberry Pi that requires some image processing.
The aim is to find a white line on a black background by finding the weighted mean in each row/column. However to avoid this being skewed by other parts of the path that may also be in the picture I want to restrict the mean to within a t... |
What do you think about this solution? I guess there are too many lists...
vowels = "aeiou"
def reverseVowels(string):
vowels_list = []
string_list = list(string)
for index,letter in enumerate(string_list):
if letter in vowels:
vowels_list.append(letter)
reversed_vowels_list = lis... |
I'm working on my ability to write loosely coupled applications that follow SOLID principles. This is a simple application trying to demonstrate the concept. Is it OK? Am I going along the right lines? What needs to be improved or changed?
I'd just like your overall opinion on the design structure and the code please. ... |
The problem:
In C++ arrays and SequenceContainers http://en.cppreference.com/w/cpp/concept/SequenceContainer (std::array, std::deque, std::vector) are necessarily zero-indexed. However, from the semantical point of view, elements of an array may be assigned a completely other range of indexes. One common example is the... |
I have been asked to write Java method code to do the below:
+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 0 |
+---+---+---+---+---+
| 0 | | | | 0 |
+---+---+---+---+---+
| 0 | | | | 0 |
+---+---+---+---+---+
| 0 | | | | 0 |
+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 0 |
+---+---+---+---+---+
I am assuming th... |
You need to design and implement a generic pool for storing objects (implementing poolable). The pool should support the following:
A support for creational pattern which would be used by the pool to create objects automatically when needed
Maximum and Minimum number of objects which can be created and made available... |
I have 2 Excel files: the first is the source file "Practice_New.xlsx" and the second is a mapping file "A_File.xlsx". A_File is a mapping file which contains cell reference of the source file ("Practice_New.xlsx") to the target file (I need to create this file, say "Practice_New_Output.xlsx").
I have written this code... |
I'm writing a simple sanity tool for a simple USB driver.
The customer is directly facing the output so I have to care about how it looks.
The log messages that I need to print are varying length, and they have "[ SUCCESS ]" and "[ FAIL ]" trailing part too and the middle is filled with dots.
So what I do is calcula... |
I'm simply getting the 3 future days from an array of objects based on the current day to display for a weather component.
This is the first time I've attempted using ES6 and it's features so please take this into consideration.
Is there a better way to do this and save the values? Have I overcomplicated the whole thin... |
This is a follow up of a previous question
I have written a file-copy routine, as I experienced unreliable results using standard Python when copying file over very slow networks.
The requirements are as follows:
run on Windows (other OS's are not a requirement at the moment, however not limiting at the moment)
not to... |
I a list of strings A and a list of keywords B. Now I want to return all strings from list A which have all keywords from B in it as a new list.
def string_search(strings, keys):
res = []
for s in strings:
full = True
for k in keys:
if not(k in s):
full = False
... |
I have a bunch of concurrent threads carrying out operations which return alerts. The alerts have to be persisted to a DB, but this cannot be done concurrently as it may cause duplicate alerts being created.
To avoid duplicate alerts I have written a class containing a ConcurrentBag<T> with a Timer that triggers Action... |
This is some code I wrote in order to see if it was possible to tile a 9x9 grid using trominoes that are shaped like this:
_
| |_
|___|
(They can be rotated.)
One issue I had while writing this is that I had to fix too many small errors (like having a 0 instead of a -1); is there some way to reduce the number of erro... |
I just started to learn Elixir and to train on Codewars.
I solved this kata but I'm not very satisfied of my code and I have no clue (literally) how to improve it.
Recursion seems the way to go here, but I'm convinced the code can be optimized a little more.
Here is the full problem :
The input is a string str of dig... |
I want to implement the singleton pattern in a header only c++ library. (Please refrain from sharing your opinion on the pattern itself!) This would be trivial if I could rely on the compiler implementing thread safe c++11 function-local static-duration object initialization. i.e.
static inline MyClass& singleTon()
{
... |
This is a GCSE practice problem, to practice for the actual coursework. Computing's my passion and I'd like to impress the examiners (note: any tips would be appreciated)
Essentially, this is simply splitting by lines into an array, printing said array into a file, then reassembling it by looping through one list by in... |
Need some comments on making the below code more effective. I'm pretty new to Haskell.
The sequence in generateSeq is generated by the rule that if x is in the sequence then x*2+1 and x*3+1 are also in the sequence.
getNumberAt gets the n'th number in the (sorted) generated sequence.
The code works but somehow I feel t... |
I have re-written my DataGrid filtering method to try to improve performance and I feel that although this is the fastest yet, there is still room for improvement on some of the slower machines my program runs on.
The DataGrid is bound to an ObservableCollection, as the user enters text into my searchBox each CompanyMo... |
As suggested by the name of source file (ex1.12.scm), I just started learning mit-scheme by reading SICP. In Exercise 1.12, I'm asked to "compute elements of Pascal's triangle by means of a recursive process." For fun and extra practice, I wrote a program to print the whole triangle. (It took me several minutes to prin... |
I'm looking for an effective way to parse html content in node.JS.
The objective is to extract data from inside the html, not handle objects.
It is a server-side thing.
I tried using jsdom and I found two major issues:
Massive memory usage (probably some memory leak)
Won't parse properly if the code is a malformed htm... |
Whilst self-studying algorithms, I came across the Karp-Rabin rolling hash search algorithm here. I decided to have a go at implementing it in Python:
For ease of reading; the data-structure description and formulas embedded in append() and skip() are:
import random
from time import process_time
def is_prime(n):
... |
I have a c# WinForms application in which I have tried to implement the Model View Presenter pattern with Passive View. I create new Views in the Presenter of my 'home screen'. I was wondering if this is bad practice, and if it is, what an alternative might be to resolve this. Also, general improvements are more than w... |
I have a small bot for social network, which accepts message "unicode XXXX XXXX XXXX ...", where XXXX - HEX values which I should convert to Unicode characters. Initially command accepted only one HEX value, and it worked fine and fast. After I modified code to accept multiple values, process slowed down (1-2 seconds r... |
I'd like you to help me review a small camera app. Most of the code comes from here; I just changed it a little bit.
I started dabbling with react-native for the first time. It seems kinda neat but I need some guidance especially with export default class DashCam extends React.Component section. The most important func... |
Given a file containing adjacent IDs:
i1, i2, i5
i3, i4
i2, i6, i7
i4, i8
i9, i3
I would like to print each of the connected components:
i1, i2, i5, i6, i7
i3, i4, i8, i9
I decided to accomplish this using a BFS on a Map datastructure:
/* Input, can be read from file easily by splitting on ", " */
val lines = List(Li... |
I just started learning Python this week and put this together for my first program (outside of a Hello World one). Does anyone have any feedback/suggestions for improvement for this? I've tried to forsee potential user input issues but I'd love to hear some thoughts from people who know what they are doing!
import ran... |
I have written the code below for the following experiment:
Subjects get simultaneous stimulation of left and right thumb and have to tell which one was stimulated "stronger" (with higher intensity, i.e. with higher amplitude of the sine wave we output)
One of the two signals does not change, while the other signal is... |
I'm building my own scheduler and I took the first step by creating a cron expression parser.
To test it I used this expression to cover each case. (I guess the 52W is wrong but this doesn't matter yet - validation comes later).
"14,18,3-39/3,52 0/5 14,18,3-39,52W ? JAN,MAR,SEP MON-WED,FRI#3 2002-2010"
Core
It start... |
Are these good implementations of parallel and sequential "extension" methods, and do they accomplish what I think they do?
My understanding is that the first one is parallel because the await applies to each invocation of the async lambda that is passed to map. So each invocation will block asynchronously and run in p... |
This is a simple program to test if integers will follow an interesting, improvable statement that if disproven, calls for a bravo.
But, ignoring the pretentious poetry, this code allows the user to input a number, which, if it is a finite, positive integer, will be calculated according to the Collatz Conjecture as sta... |
Following this reference, below is the list abstraction implementation using array,
/* list.h */
/*
List is an ordered collection(sequence) of homogeneous type elements(unique or duplicate).
By definition, List is not suppose to have collection of heterogeneous type elements.
All elements in a List are rela... |
for my c++ class I was asked to write a class with the following characteristics:
Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL).
Your class should have the following interface:
• A no-argument constructor that allocates a 32-element vector
• A c... |
We have a (Spring) REST API that I was tasked to write integration tests for. I wrote various ways to test our REST API and then just decided to make 1 integration test class that processes all JSON files that can be submitted in PUT requests against our REST API and also tests security and various GETs and DELETEs. ... |
The first part of the query grabs Policy's Premiums, Effective and Expiration dates. The second part creates Calendar, and third part (final SELECT statement) returns Earnings broken down by Month and Year.
Everything works fine and takes just 3 seconds to display the result. But then I need to filter what PolicyNumbe... |
I'm studying alone, so I don't know if I'm writing efficiently. Could this slot machine simulator be improved? How?
import acm.program.*;
import acm.util.*;
/*
* THIS PROGRAM SIMULATES THE SLOT MACHINE
*/
public class cap6ex5 extends ConsoleProgram{
private RandomGenerator rgen = RandomGenerator.getInstance();
pr... |
I wrote an answer to this question on the Software Engineering SE site and was hoping to get it critiqued. (I'm told that it's acceptable to do so).
Essentially, this code uses reflection to check to ensure that none of the parameters of a method are null and none of the strings are empty or consist only of whitespace.... |
I am a Year 12 student studying CS for my A-Levels. I have had previous Python experience but it is obviously not to professional/industry standard. Therefore, my goal for this review is for my code to be criticised, allowing me to improve towards reaching such standards.
The program is a computer version of the Battle... |
I wanted to create some kind of generic text-based adventure-game
engine to see if I could build an interesting puzzle out of it.
The idea was to define a mini-language to be able to define the
adventure in a file and provide sessions of play like:
You are at the entrance of a temple. Type temple to go in.
> temple
A ... |
I wrote a solution to HackerRank Strange Counter:
The counter counts down in cycles. At t = 1, the counter displays the number 3. At each subsequent second, the number displayed by the counter decrements by 1.
Each time the counter reaches 1, the number becomes 2× the initial number for that countdown cycle.
The seq... |
I'm struggling with some coding-inexperience. The code I've written below, is extremely inconvenient and ugly to look at.
My question to you is:
How can this be done more efficiently? The way I've chosen to do it, is rather inefficient. Pay attention to the def freq_2dice(n, N): section of the code, as well as the pr... |
This is my first attempt at Scala programming. I tried to be functional but I'm not sure if I have achieved that.
DataTypes.scala
object DataTypes {
case class Position(xPos: Int, yPos: Int)
sealed trait Direction
case object N extends Direction
case object S extends Direction
case object E extends Dire... |
I am looking to speed up the search for black and white images. I have about 150,000 images that I need to check but this is taking so long. How can I speed up the code?
Private Sub BlackOrWhite()
Dim iPath As String = txtFile1.Text
Dim allFiles() As String = IO.Directory.GetFiles(iPath, "*.*", IO.SearchOpt... |
I wrote from the ground up this small piece of code which transforms dates and times formatted in ISO 8601 format into a more human readable format, client-side. The main goal is that you can create multiple and fully customizable instances that differ from each other for any given node living inside the DOM tree. It u... |
This code is meant to reduce a given string as much as possible by deleting adjacent characters. Here are some examples:
reduce('aa') = 'Empty String'
reduce('ab') = 'ab'
reduce('abba') = 'Empty String' # remove 'bb' then 'aa'
reduce('bbb') = 'b' # can only delete 2 chars at a time
This is based off this HackerRank q... |
Here is my iterative implementation of the Counting change example in SICP. Please note that I'm a beginner, which means I only know the basic syntax for the time being.
Requirement:
How many different ways can we make change of $ 1.00, given
half-dollars, quarters, dimes, nickels, and pennies? More generally,
can... |
In my project we have a few singletons, which tends to be problematic in unit tests. So I wanted to find solution for the problem. Here is what I came with so far:
smart_singleton.h
class smart_singleton
{
public:
static std::shared_ptr<smart_singleton> get_instance();
private:
smart_singleton();
smart_si... |
(See the next iteration as well.)
I have this Java program that can en-/decode files, both text and binary. What comes to critique I want to hear anything regarding these points:
Performance,
Modularity,
Coding conventions,
Naming conventions.
Code
BitString.java
package net.coderodde.compression.huffman;
import jav... |
I got fed up off opening a set of applications when I wanted to code. So I decided to read up on AppleScript and came up with the following task for myself.
Open a application of choice on a given page/directory. Arrange that
application depending on your monitor width/height by setting the
application display si... |
In my application I need to perform several SSH commands from Windows to a Linux machine.
Since I need to reduce as much as possible the SSH calls overhead and also limit the number of concurrent SSH commands, I thought to keep some sessions open and create a session pool class to manage this.
The following code se... |
I am implementing my own double-indirecting shared-ownership smart-pointer because I needed a way to replace the managed object a group of smart-pointers is pointing to with a new object (it's the method reset_all in the code below).
I tried to keep this as close as I could to the std::shared_ptr's interface, while avo... |
I would like some opinions on this Mobile Menu plugin I wrote for work. We develop custom WordPress themes, nothing too advanced or anything. I would like if anyone could just take a look and provide any pointers on what I could make better. This is my first actual plugin, so I am open to any critiques.
The functionali... |
I'm curious if there is another way to code this. Could it be done with a while loop for instance?
public static int numUnique(double[] list) {
int uniques = 0;
if(list.length == 0){return 0;}
for(int i = 0; i < list.length; i++){
int dups = 0;
for(int j = i + 1; j < list.length; j++){
... |
Summary
Usage will ask for a Context and a @MenuRes and then use the PopupHack.class to inflate the menu resource and retrieve the Menu and MenuItems.
Reasoning
To allow the creation of a List<Object> by supplying a menu resource xml. For use within a larger project/library.
PopupHack.class
static class PopupHack exten... |
So I have a program that visualizes data from files (csv,txt,etc.). These files are saved to database as individual tables. In my application I have DocumentExplorer which is just a module with a list of available documents(files). You can open and close any document you want, and you can have multiple documents opened... |
I was searching the internet for some Python exercises, and I've found a lab assignment from University of Toronto. Here's the major of it:
Question 1.
Welcome Message In the if __name__ == "__main__" block, write code that displays the following: Welcome to the calculator program. Current value: 0
Question 2.
Dis... |
I have implemented a BST for an assignment in C#. I am still in the process of implementing IEnumerable and ToList functions but the core of this is done.
Please review and critique this code. Additionall, I am using explicit interface implementation in order to force clients to use the interface to code against this.... |
The ZCO is today and I did 5 problems to prepare for it overnight. One of the problems is the CodeChef Chewing problem.
The code takes an integer N that specifies the number of chewing gums, integer K that is the maximum hardness quotient of a pair the chewing gums possible to be eaten. This is followed by N integers ... |
This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using depth-first search.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from queue import PriorityQueue
from copy import deepc... |
# Prints Updates of whats currently happening
print('Importing Libraries')
# imports stuff
from tkinter import *
import sys, string, os, subprocess, openpyxl, time
from selenium import webdriver
from splinter import Browser
from twilio.rest import TwilioRestClient
import tkMessageBox
# Prints Updates of what's happenin... |
Background
Given a string (s) and an offset into that string (offset), find the whole word that can be found at the given offset. (Helpful for auto-completing text.)
Code
Consider:
import static java.lang.Character.isSpaceChar;
public final class TestWordParsing {
public TestWordParsing() {
}
public void run()... |
I previously attempted to implement a Graph class which has a method that returns a path between 2 nodes using depth-first search. This is my latest attempt at this (using the feedback I got from last time).
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an ... |
I have made a small app in React that fulfils the following user stories:
GIVEN I add an item using the form
THEN I see the text appear in the list below
GIVEN I see items in the list
AND I click the close button next to a list item
THEN the list item disappears from the page
GIVEN I refresh the page at any point
TH... |
I've decided to translate an old Unity AppIndicator I had written in C to Ruby, so I can practice coding with it (got a little bored with the completely beginner lessons I've been following, which I'll finish!). The C indicator itself was a bit raw, I kind of wrote it in an afternoon, so I think it reflected on the Rub... |
What it does:
Speak a random word chosen from an array and ask the user to type the word in the box for 15 seconds
If right, +1pts, reset the timer and go to next word.
If wrong: do nothing.
After 15 seconds: game over.
body {background-color: black; color: white;}
.center {
width: 50%;
height: ... |
This code is meant to find the median of a list of integers. The list is assumed to be of odd length.
This is based on this HackerRank question.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from heapq import heappush, heappop
... |
So i have a ConcurrentDictionary<int, string>
The "int" is merely the way i store the key, which i want more recommendations on.
Currently i do like this.
public string memoize(Func<string, uint, string> functor, string code, uint id)
{
//Used for the lookup to identify if it's been inputed before
... |
Fairly new to learning interview questions and I saw this one and gave it a shot. I would very much appreciate some constructive criticism of how I went about it and what you would tell me if you were the interviewer and watched me implement it this way.
public class FizzBuzz {
public static void main(String[] args) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.