instruction stringlengths 71 71.9k |
|---|
I have a question and want to know if my class is considered object oriented.
class Player {
private $db
function __construct($db) {
$this->db = $db;
}
public function set_player($name, $position, $number, $team) {
try {
$sql = 'INSERT INTO players SET playername = :pl... |
I'm a beginner in Go, and just finished the Golang tour. This crawler is not the same as the one in the exercises in the tour but something I wrote myself. I am looking for suggestions for making it better in terms of idiomatic Go.
package main
import (
"fmt"
"sync"
"net/http"
"log"
"regexp"
"i... |
The following methods just write strings to the screen over time to make it look like a typing effect, instead of all at once. The only difference is the argument in the foreach loop.
I end up having lots of similar methods like these. How do I refactor them?
public IEnumerator TypeCharText(string message, Text textCom... |
The latest refactoring for Rubberduck is Implement Interface. This refactoring will check whether the active class fully implements the selected interface by comparing the definitions. It knows the class based on the Implements statement, which looks like Implements IXyz.
This extension method finds the interface bas... |
In a couple of months I'll be part of a large(ish) project, and there's good chances my team will be a lot bigger, with at least 2 programmers (probably 3) and some 3-5, or more, consumers of the API we'll build (we're building a game, and they'll script high level logic using a scripting language we've yet to choose).... |
I have an image and a palette that I want to apply on that image, that is, change all colors of the image to match the closest they can find on the palette. While I have multiple ways to do it, I want to let the user choose if he wants the algorithm to be more precise, or faster.
The basic algorithm is this:
int pIndex... |
My code handles concurrent requests by waiting for the result of an already running operation. Requests for data may come in simultaneously with same/different credentials (including empty credentials).
For each unique set of credentials there can be at most one GetCurrentInternal call in progress, with the result from... |
This is my solution to Project Euler #92:
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before.
For example,
44 → 32 → 13 → 10 → 1 → 1
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
Therefore any chain that arrives at 1 or 89 will b... |
I want to place an element alternatively between any two elements of a list.
l1 = list('abcde')
fill = 'z'
How it should look like:
['a', 'z', 'b', 'z', 'c', 'z', 'd', 'z', 'e']
My solution:
fill = 'z'
l2 = [fill]*(len(l1)-1)
[x for t in map(None, l1, l2) for x in t if x]
Is there a better approach, i.e. that doesn'... |
I've written another diagnostic for VSDiagnostics that adds compile-time security for your formatting specified in a string.Format call. The exact scenario it guards against is when you have something like this:
string s = string.Format("Hello {0}, I'm {1}!", "John");
This will throw a runtime exception because it ca... |
I wrote a Vigenere cipher in Haskell, but I feel like I way overdid it. This is the second version of the program that allows custom cipher tables, removing the limit of just having letters from A to Z, and nothing more.
I'd like to get some tips on what I could've done better, as this is the first program I've writte... |
I've made vast improvements to my previous ls implementation, including:
Added new flags:
-g (omit owner listing)
-o (omit group listing)
-r (reverse with sorting)
Removed a flag (which wasn't working entirely):
-R
Added long options for applicable flags (as defined)
Defined a single buffer size
Used more proper... |
First of all, I didn't write this code from scratch, I'm pretty sure I took it from an online tutorial and modified it slightly to suit my needs. Can the code be improved in any way? I feel it's quite long winded and repetitive for a relatively simple task.
function paginationAdvanced($select,$query,$per_page,$page,$ur... |
I am trying to create a program to manage my Prosper investments for me as an intro to Haskell project. I created a post a few weeks ago for some of the simpler backend calculations: Recommend Next Note Purchase
Now I've started working on the web APIs in order to retrieve my account information from Prosper. Though i... |
For the online text-based browser game OGame I am working on an application with as aim to assist the users where possible, for this I have a server-side part and a client-side part, the respective repositories can be found here for the server-side part and here for the client-side part.
The client-side part is impleme... |
From K&R exercise 1-23,
Write a program to remove all comments from a C program. Don't forget
to handle quoted strings and character constants properly. C comments
don't nest.
My solution,
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLEN 10000 // max input length
int get_input(c... |
This Python module contains helper functions to download the result page of SEDE queries and extract columns from it, most prominently:
fetch_sede_soup(label, url): download the page of SEDE results, cache it or else use previously cached content, and return as a BeautifulSoup instance
fetch_table(label, url): fetch a... |
Maybe I totally reinvented the wheel, or maybe I've invented something new and useful. Can one of you tell me if there's a better way of doing this? Here's what I'm trying to do:
I want a generic reduceBy function, that works like an RDD's reduceByKey, but will let me group data by any column in a Spark DataFrame. Yo... |
Just for practice in the mathematical side of programming, I decided to rewrite the math functions, with the addition of the root() function, which the Math library does not provide, but can be easily done with Math.pow(x, 1 / y) where you want to find out x to the yth root.
I also wrote this to review the Newton's Met... |
One of the latest refactorings for Rubberduck is Extract Interface. This refactoring will take a class, display all public members, and allow you to select which members you wish to include in your interface. Next, it creates the interface, adds Implement <Interface Name> to the top of the file, and calls Implement I... |
Built so that it doesn't depend on DLLs: http://s000.tinyupload.com/?file_id=25464905355948914118
My goal is to make a console calculator with a subset of the functions that are available on a scientific calculator. This source is WIP, the dependencies that are used by this are the ones that Visual Studio 2015 gives y... |
This question is an improvement I did based on recommendations from this other question: Simple object-oriented calculator
JSFiddle
var Base = function (self) {
// base class initialization
self = self || {};
self.override = function(method, body) {
var overriden = self[method];
self[method] =... |
My goal is to make a consistent and easy way to determine how a function fails/succeeds. I'm looking for code review of my Status class for any bad practices, code that isn't thread-safe and general improvements and changes.
For logging and debugging I always needed to know how a function failed and print this out as r... |
Problem statement
Write an anonymous function which take email address as parameter and returns true/false after validating the input parameter.
Objective
This assignment will help you to master the following concepts:
function
closures
Solution
<!DOCTYPE html>
<html>
<head>
<title>Anomymous function</... |
Problem statement
Write an IIFE in which we have to validate the input provided from a form using closures. The form consists of name, email, phone, address in which name, email and phone number should not be left blank. Also validate that the given email is a valid email id using JavaScript.
Objective
This assignment... |
I am currently working on a project in Java, and I use JavaFX for the GUI of the System. Currently, I am in the designing phase of the system, where I am designing the look of the system as well as setting up the basic functionality like navigation. I would highly appreciate it if someone can review my simple navigatio... |
I have made a little Tic Tac Toe console application using OOP techniques and would love to get some advice and guidance on what I have done. I have tried to structure the program to be as organized as possible but I am sure there is a lot of room for improvement.
main.cpp
// TicTacToeOOPV2.cpp : Defines the entry poin... |
I recently came across this SO question asking for methods to determine if a std::string represents an integer. There is also this SO question for floats. I decided to code up a few methods consolidating these questions.
#include <string>
#include <algorithm>
#include <iterator>
#include <cctype>
namespace detail
{
... |
In constructing an answer to this question, I wrote a small debugger/simulator for the MAC-1 instruction set.
There are a number of simulators already out there, but most are either too old to be compiled and run using a modern version of Java or C or C++ or they intended to exercise the machine down to the internal re... |
In my iOS application, I've created a singleton class that reads a configuration plist file and provides accessor methods to easily retrieve the values:
class Configuration{
struct Key{
static let searchRadius = "searchRadius"
static let significantUserMovementThreshold = "movementThreshold"
}
... |
I wrote the following to check whether a string ends with a second string.
function isEndOf(origin, target) {
return (origin.substr(target.length * -1, target.length) === target);
}
Usage:
isEndOf("A long time ago in a galaxy far, far away", "far away")
This takes a substring with the size of the target string coun... |
Just looking for some advice and I know using std namespace is bad but I didnt have the time to do all the using stuff. I want help on what here is good and what is bad practice :).
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class file {
public:
file() = defa... |
This code is made to generate a list of unique elements of the array made of the other two arrays.
The fact that we need two lists to convert in two different array is part of the task.
This code handles with the task, but there's a lot of global variables. As far as I know, it is not good practice.
Tell me, please, ho... |
This code allows printing in C with a style similar to C++ ostream. By using _Generic() (see GP()) to form a string specifier, the compiler handles the selection of printf() specifiers.
No more mis-matched specifiers!
Requested review goals:
Design concept: Ways to improve?
Implementation: What weakness & strengths... |
I want to improve the performance of this program.
count = 0
store = []
n = 9238899039
for i in range(1,n):
if i*i*i <= n:
count += 1
store.append(i)
print count
At the moment it is very slow. I need to find all cubic numbers up to n.
|
This is my second attempt at K&R 1-23,
Write a program to remove all comments from a C program. Don't forget
to handle quoted strings and character constants properly. C comments
don't nest.
I was previously packing characters into various io buffers, and someone suggested this was not a good choice. Thought I'd ... |
Question:
Given a sequence of positive integers A and an integer T, return whether there is a continuous sequence of A that sums up to exactly T
Example:
A = [23, 5, 4, 7, 2, 11], T = 20: True because 7 + 2 + 11 = 20
A = [1, 3, 5, 23, 2], T = 8: True because 3 + 5 = 8
A = [1, 3, 5, 23, 2], T = 7: False because no seque... |
I am developing a class (in a C# MVC 5 project) that originally had a using block within a single method, and it got to be very huge after placing formatting statements and other code in the using block.
I am using the Nuget Epplus package to export a model's contents to an Excel document, and all of the tutorials I ca... |
I have made a backtracking Sudoku solver in Python but it's working quite slow.
Originally, It had been working on 4 by 4 grids, which worked fine.
But now, trying to solve 9 by 9 grids takes a very long time.
I haven't found out the exact reason but I feel that there is one major flaw that is making it so time consumi... |
I implemented observer pattern and it will be great if someone can do review of my work and say what should be done better.
What is the problem. Application monitoring rss channel, if there is something new then should do 3 things: send email to registered user that following stock which has news (only EBI and ESPI ch... |
I have modularized my code and currently my "main" function is movieSalesReport(). I am coming from Python where you can have the functions return multiple values. In C++ it is not so simple and I learned through this question that I had to use something called referencing in C++ in order to mimic returning multiple va... |
I wrote an application a while back to plan and manage drones races. (Well, it could be anything with identification numbers going through checkpoints.) At that time, communication between the gates (checkpoints) and the device running this application was done through XBee radios. When a gate detected a drone, it sent... |
Recently I started to use mvvm light messenger and it lead to creating this ugliness which I have to refactor now. What would be the best future proof way to refactor this whole class?
public partial class RootView : Window
{
public RootView()
{
try
{
InitializeComponent();
... |
It is a single-player game. In the beginning, there is a row of integers. In one move the player can take a certain amount of adjacent numbers (let's denote it T). Then the player's points increase with the sum of the chosen numbers. The player can take S moves at most. The goal is to determine the maximum points that ... |
Company name asks you to build a website with 7 boxes shaped like a c, which should turn green on click, and then when all are clicked, should turn red in reverse clicking order.
https://jsfiddle.net/yx296/dvacLduw/
document.addEventListener('DOMContentLoaded', function() {
var boxHolder = document.querySelector(".... |
I have these types:
data PizzaType = Cheese | Pepperoni | Anchovy
data PizzaOrder = PizzaOrder
{ p_type :: PizzaType
, p_specialInstructions :: Text
}
I want to use Aeson to create PizzaOrder instances from this JSON structure:
{
"type": "pepperoni",
"specialInstructions": "please cut into nine sl... |
Background
Some time ago I've encountered some very good articles about neural networks that represented an ANN as a set of matrices, so everything was done using matrix operations. These articles show code written in Python, and since I know Python well, I decided to translate it to C++ (which I'm currently learning).... |
I wrote a tiny shell script that basically installs a script into your system by copying it to someplace like /usr/local/bin, chmodding it, and adding it to your PATH. It works on both Unix and Windows (via an emulation layer like MSys or Cygwin). Its source code is available on GitHub. Here is the script in its entire... |
I'm trying to shorten this piece of my code into a loop:
<?php header('Access-Control-Allow-Origin: http://mysite.com'); ?>
<?php
if(sizeof($_POST))
{
file_put_contents;
} else {
echo "ERROR! Must be activated from Tampermonkey script!";
exit();
}
file_put_contents(
"content.html",
"<st... |
Original question:
Function to split either a string array or string into a string array
I was asked why I didn't write multiple functions or something like that. The point of the function is to be a single one and to be able to receive an indefinite number of strings or string arrays and get the job done. Restrictions... |
This is the second thing I've ever written in Python. I am just looking for what I could improve upon along with things that could be done better. It is as compact as I could make it with my current experience.
import random
def war_handler():
war_handler.count += 1
print "War is {0} is happening.".format(war... |
I want to order columns of a dataframe using a substring of the column name only. Suppose my columns are named
df <- data.frame("x_b"=5,
"y_b"=2,
"x_a"=6,
"y_a"=3,
"y_c"=1,
"x_c"=4)
and I want to order them using a first-order and a s... |
Remove duplicate elements from linked list.
#include<iostream>
using namespace std;
class LinkedList{
private:
int data;
LinkedList *next;
public:
void insert(LinkedList **start, int data){
LinkedList *p = new LinkedList;
if (*start == NULL){
p->data = data;
p->next ... |
My question is similar to before, but now the code has changed completely. I would like to understand if this code is vulnerable to mysql injection.
<?php
// Define our querystring variables
$option = (array_key_exists('option', $_POST) ? $_POST['option'] : false);
$view = (array_key_exists('view', $_POST) ? $_... |
I think this isn't right way. Maybe you can suggest something about error-displaying in error-container which fill in JS.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="display">
... |
This is my submission for the Prime Generator on SPOJ and it was accepted. Are there any improvements/changes I can make?
Input:
The input begins with the number \$t\$ of test cases in a single line
(\$t \le 10\$). In each of the next t lines there are two numbers \$m\$ and
\$n\$ (\$1 \le m \le n \le 1000000000\$,... |
I created a short python program that can create a list of random unique nodes with a given length and a given number of strategies. The GA runs through a given number of generations, changing a random selection of strategies by using ordered crossover and an inverse mutation between two random indices. Each strategy h... |
I am writing a program that allows a user to interact with MIDI-connected devices. Upon connecting a MIDI device, interactions with this device will update a GUI. Updates to the GUI include what keys are being pressed, if the volume is turned up/down, etc. In addition, the user can "request" the status of MIDI componen... |
In continuation with this question,
Animal class has four fields:
name
sound
owner
favFood
Cat derived class has one field
mode
Derived class Cat is created such that every instance of Cat inherits instance members of Animal. In addition, Cat adds a new instance member mode.
Constructor pattern is used amidst con... |
I have always wanted to write a fluid simulation, and with the help of a paper and some StackOverflow users I've got something that works. My goal is to have a program that someone can run right away without having to install anything.
My plans:
Fix framerate (eventually)
More configurable user input
Have almost all ... |
I am a new programmer and I want to know if I'm inheriting the right styles. I don't want to pick up any bad/amateur habits. Any advice would be much appreciated.
This is an isUnique function I wrote in C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int x;
char s1[] = "dog hi cob... |
I am using spring-boot, spring data, and Java 6. Here is an example from a business layer to save student details.
Srvice interface:
public interface StudentService
{
public StudentDTO save(Integer stdId, Integer divisionId, StudentDTO studentDTO);
}
Service implementation:
@Service("studentService")
public class ... |
I have the following Ruby code, which parses an XML document sax style (it's a very simplified version):
require 'nokogiri'
class ParsingError < RuntimeError; end
class Parser
def initialize mapper, collector, error_collector
@error_collector = error_collector
@sax_handler = Handler.new(collector, @error_co... |
I wrote this simple page to help at work, and as an exercise to get more familiar with JavaScript.
I'm especially interested in help with style and structure - is this "standard"?
I know the input isn't validated at all - feel free to make suggestions here but this isn't my main concern at this time.
behavior.js:
var... |
I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before.
To achieve this I wrote this function:
function setQuestion() {
var q; // question we will eventually ask the user
for (q in questions) {
if (!(q._id in ... |
I have 2 Flask apps (different projects) that work together . One implements some API which uses tokens for auth. The second one consumes the API and makes a web interface for it. Now I have a login function that sends the username and password to the API, and if correct, gets the auth token in return. Once I have the ... |
I have written some code to practise graphs. Graph is represented as vector<list<int>> . Would you share some feedback with me?
Are algorithms correct and perform well?
I implemented graph using vector<list<>> because of the name "adjacency lists". However now I think using unordered_map would be cleaner and would per... |
This snippet is about sorting a set of strings using merge sort. However, this version is tailored for strings as it relies on lcp values:
Given two strings \$A\$ and \$B\$, \$lcp(A, B)\$ is the length of the longest prefix shared by both \$A\$ and \$B\$. The cool point to note here is that if you know at least a lower... |
I have been working on a long project trying to understand the basics of multi-threading. The application is supposed to simulate a Shop and a Customer which share a Box and a PayPal account.
Main.Java
package exe5;
public class Main {
static Thread mainThread = Thread.currentThread();
public sta... |
I'm looking for a fast OR simple way to calculate the volume of a user-entered cylinder. Here is my solution:
#include <iostream>
using namespace std;
#include <math.h>
int main()
{
long double pi = acos(-1);
cout.precision(1000);
long double radius;
long double volume;
long double height;
cou... |
I have walls that I can spawn. They wll move in one of four directions, up, down, right or left. Now I can set, wether the wall is thin, wide, long or short, but the problem is:
Nearly everything I do with the walls depends on wether they move up, down, left or right and because of this I use my direction enum extremel... |
Give all the partitionings of a string s such that every substring of the partition is a
palindrome
What is the time complexity of this solution? And, how can I improve my code overall?
List<List<String>> resultLst;
ArrayList<String> currLst;
public List<List<String>> partition(String s) {
resultLst = new Arra... |
I am trying to make an OOP abstraction for a very simple HTTP client. I have also created a simple abstraction for a (GET only for now) HTTP request.
I am using winsock2 sockets for Windows and examples from the internet.
This is the request class:
httpRequest.h
#ifndef httpRequest_H
#define httpRequest_H
#include <s... |
I wrote an isPermute method. Can I get some tips and advice on better coding style?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
bool isPermute(char*, char*);
char* sort(char*);
int main(int argv, char **argc)
{
printf("%s and %s are %spermutations of each other. \n", argc[1], arg... |
I have written a working Brainfuck interpreter using ClojureScript, reagent, core.async and dommy. I am not very satisfied with the code, however, in particular the central part of the code - the interpreting function, step. It is a pages-long mess of nested conditionals. I would like to simplify it somehow. One thing... |
Let's say you want to extract the output of a console application till you've found a certain keyword. If you have found the keyword the started console process still should be running, however the function which has found the keyword should return.
Here is a minimal application which simply creates an output of n line... |
This is for commercial purposes. It's not going to a database, but will just be emailed to a person via phpMailer.
I am not good at PHP (truly awful). I'd like to know whether this is good enough for going production or not.
<?php
session_start(); //allows use of session variables
if ($_SERVER["REQUEST_METHOD"] == "PO... |
I needed a quick caching mechanism to save a bitmap (picture). There was no way I could get the bitmap to the class where I need to upload it to the server so for the sake of organization and code cleanliness I created this. I have never seen this before implemented this way but to me this not only fits the purpose but... |
I am currently working on a GPA Calculator side project over holiday break to become more familiar with Swing, but I find the number formatting is more complicated than in regular Java. At the moment I have a working prototype, but the number formatting on the overall GPA is way to long. I have tried to achieve this in... |
I have created a solution for the problem as below:
Given a string S consisting of letters 'O' and 'Z'. Calculate the
minimum number of changes required such that all O's are adjacent to
each other and all Z's are adjacent to each other. One change is
equivalent to swapping two neighbouring letters
for e.g for a... |
Can I please have some advice on optimizing, cleaning up my code, and places where I could save space/time?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
bool pal_perm(char*);
int main()
{
printf("The output is %sa palindrome.\n", pal_perm("abbas")? "": "not "); //Output: The outp... |
The Go programming language has that slice type, which is under the hood a pointer to an actual array. This allows treating the subarrays as actual arrays with almost no performance overhead. This code snippet is about implementing slice type for C++ arrays and vectors.
slice.h:
#ifndef SLICE_H
#define SLICE_H
#includ... |
I wrote a script to convert CSV files in human readable format and vice versa.
Human readable format is achieved like so:
$ ./transform table.csv inflate
cola colb colc
1 a g
2 b g
3 c g
4 d g
5 eeeeeeeee g
And conversion back to CSV is done with:
$ ./transformtable ... |
I am creating a connect 4 game in python and I have managed to write the code so that it runs. However I have a lot of duplicated data in it and was just wondering if anyone could help me to refine it to minimise this?
Here is my code so far:
def CreateBoard(r, c, b, n):
for i in range(1,(r+1)):
n.append(str(i))... |
I'm trying to get back into programming by building an app I've had in mind for quite a while. I've created an SQLite database and have managed to get some data in it. I'm trying to display the data inside a Listview, and whilst it is displaying, I'm concerned I've made things more difficult for myself for making the L... |
I've started out working on a larger project using Angular for the first time.
For visual feedback, I'm using Waves (Github) (you can see a demo page here).
The standard way to use Waves is to include the script along with its CSS on the page and once the page has finished loading, call
Waves.init();
to bind to all el... |
Write a procedure substitute that takes three arguments: a list, an old word, and a new word. It should return a copy of the list, but with every occurrence of the old word replaced by the new word, even in sublists. For example:
> (substitute ’((lead guitar) (bass guitar) (rhythm guitar) drums) ’guitar ’axe)
((lead... |
I would like to reverse a list using cdr, car and cons. Since lists in lisp are asymmetrical (can only insert at the beginning), I am interested on how one would write a procedure to do that without using (append). Please review my code.
(define (reverse l)
(define (aux orig result)
(if (null? orig) result
... |
I am trying to learn JS and I am trying to make a simple calculator which will calculate price against number of people and will give discount on some amount of people. For instance, every 6th person is completely free.
Here is example what I did until now.
HTML
<input type="number" id="int_no_of_people" value="" o... |
Here is code I wrote to concatenate data files into master file. Once the data to be pasted into the master sheet exceeds the number of rows left in the master sheet, the program will create a new master document and continue the process. Help me clean it up and make it faster if you can.
Option Explicit
Public NewMast... |
I am trying to write a code that:
First Prompt: asks the user to select the folder that contains all zipped folders where each zipped folder contains a data file.
Second Prompt: Ask the user to select the master folder path to place the unzipped data files into.
The program will unzip the first zipped folder, copy th... |
I am currently working on a side-project and have the basic foundation and architecture I want in place for the site. I wanted to get your opinion and thoughts on my current practices and methods before I get too deep down the rabbit hole and any potential issues would be difficult to remove.
The basic premise of the s... |
I am trying to implement an HashMap in C. I am trying to used a linked list style of interfacing to make adding and removing keys easy and efficient. Searching is not something I am considering at this point as it is early in progress. I am looking for any tweaks that could make this faster, more memory efficient, more... |
I have a MongoDB collection setup where each document's JSON looks like this:
{
"_id" : "Stuff",
"project_id" : "1234",
"VehicleEntry" : [
{
// Irrelevant fields removed.
"VehicleStatus" : "PASSED"
},
{
// Irrelevant fields removed.
"Ve... |
This question is an improvement I did based on recommendations from these other questions:
Simple object-oriented calculator
Simple object-oriented calculator - follow-up
To those looking this question first I'm trying to find a correct OOP model I can use in JS. I initially found a very different solution from what's... |
I liked this problem because there are so many sub-problems that are interview problems in their own right-- (reverse linked list, find midpoint)
var Node = function(val) {
this.val = val;
this.next = null;
}
var a = new Node('r');
var b = a.next = new Node('a');
var c = b.next = new Node('c');
var d = c.next = ne... |
Problems was to calculate maximum product of word lengths:
Given a string array words, find the maximum value of length(word[i])
* length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If
no such two words exist, return 0.
Given ["abcw"... |
To try and track down a troublesome AS400 bug, my company wants me to keep track of the order in which files are put into a folder. I spent an hour whipping something up in Go, but I'm still pretty new to Go so I'd like an opinion on a couple points:
Idiomatic Go: how do I make it more "Go"-like?
My method of freezing... |
I recently got to a certain exercise in a book I am reading, and am looking for feedback. It is a program in which the user picks a number and the computer uses algorithms to guess it. If there is any way that I can improve my code, feedback is really appreciated!
#include <iostream>
#include <string>
#include <cstdlib... |
I likes my use of functions so I'm mostly looking for little things but if you see something tell me :)
#include <iostream>
using namespace std;
void addQuarter(double &num); void addDime(double &num); void
addNikle(double &num); void addPennie(double &num);
bool quarterValid(double num, const double finalNum); bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.