instruction stringlengths 71 71.9k |
|---|
My task is to select items from a pool to match a specific selection criteria in a browser game.
My Problem: Usually my algorithm can find the desired results after 200–400 iterations. But every once in a while it does not find a result even after 1 000 000 iterations.
I would be very happy to receive optimizations or ... |
The requirement: search a string in a text-string (from DB) and show additional info around when presenting the result.
Examples:
text string = "The Quick Brown Fox Jumps Over the Lazy Dog"
search ==> result:
"The" ==> "The Quick ..."
"Quick" ==> "The Quick Brown ..."
"Brown" ==> "... Quick Brown Fox ..."
"Lazy" ==> ... |
I just started learning C, and got to the "for loops"—where an exercise is given to convert Celsius to Fahrenheit ( from -50 to 1000 with a step of 20 ), and print the values. I decided to play with it by adding different steps when certain values are reached.
I do have some programming experience ( Python/Java/JavaScr... |
As a part of a console utilities module, I created a function that takes a table in the form of an array of arrays, and generates an ASCII table with the given contents.
I've also added the options of adding a header, determining the in-cell alignment, and adding a border to the table.
Table cells have auto computed l... |
I have 3 ToolBars that I use across my whole application
The first one is just a ToolBar with a close button.
The second one is a ToolBar with a close and delete icon.
The third one is a ToolBar with a close and home icon.
Here is my case, I use this ToolBar in many places, and I dont want to use Fragment for some rea... |
So I just experimented with some code to make a huge if-else construct more human readable, extendable and configurable (switch positions of conditions).
The idea was to have a vector that contains all conditions and their actions and then just iterate over the vector, executing their ConditionalAction.
I solved it wit... |
I have a set of functions to run according to combined options. Options are easier/harder, add/multiply, wait/nowait, 1/-1.
You can see the whole module here.
For now I have put all functions in an object to be able to access them according to the options. For instance:
var stair = {
down: 3,
sameStairCount: 0,
s... |
I have a map of cars Map<String, Set<Car>> which can be returned by getCarsMap() method where key is model of car , and value is list of cars of same model.
I would like to improve Car addCar(Car car) function. For now I wrote this a bit ugly piece of code.
public Car addCar(Car car) {
if(getCarsMap().entrySet().stream... |
This basic function to detect negation while performing sentiment analysis. So that not good kind of words can be considered a negative.
This code is working fine. Can someone help to improve it or find if any bug present?
def negate_sequence(self,text):
"""
Detects negations and transforms negated words into "... |
Is it normal to catch exception in concept of MVVM inside model? Or how should it be? How to improve this code?
This is simple application that allows user to drop .pfx certificate on the label. LoginModel checks the password for validity and check the publisher. if the validation fails throws an exception that is catc... |
The original task was to find the first non-repetitive character in a string.
Every now and then I read questions here on Code Review and try answering them myself, and as such I stumbled upon this one.
Now, I have two solutions:
The first one:
struct ch {
int num;
char c;
} characters[127];
char find_first_no... |
Problem statement: In Windows Workflow Foundation we have a long running state machine. We had an issue with SQL server deadlocks putting workflows into a suspended state. Since Workflow instances are independent actors, we cannot easily coordinate these calls. As part of our workflow error handling strategy, if the... |
I want to refactor below code.
Do() method below gets the position number from other component "_calComponent.GetPosition()" and compares the
value with the pf control positions (PfControlPositions).
As you can see there are many if conditions that I had to use here. I did not like this approach. I am not able to w... |
I'm trying to implement the UoW pattern using ADO.NET and this is what I've achieved so far:
The IUnitOfWork Interface:
public interface IUnitOfWork : IDisposable
{
IDomainTableRepository DomainTables { get; }
IVariableRepository Variables { get; }
IModelRepository Models { get; }
IStructur... |
I have a word document which has a lot of active x checkboxes on it and I have just been told the way it has been coded and done could be improved upon a lot, so I am asking for a bit of help.
To quickly explain it, the checkboxes are tied to a "completion overview" at the bottom of the document.
The code on the checkb... |
The following code displays a Timetable, but the code needs too long finish the whole process.
<?php
class showTimeTableModel {
static $home = false;
static $type = NULL;
static $c_id = NULL;
static $class = NULL;
static $subjects = NULL;
static $kn;
static $year;
static $kw;
static... |
I recently got in really deep on a question to find the overlapping meetings and I rewrote a bit of the code and added some things to the code, and I would just like a general review of my code and what I could do to make it even better, maybe performance wise or whatever.
Here is my LINQPad 5 Code Dump, you should be ... |
I am a beginner programmer and I've been trying to complete an unbeatable tic-tac-toe program, my code is below. The program itself works, but it seems rather inefficient, as I literally have to type out every case of possible victory or defeat. Any suggestions on how to make the code more efficient, or general suggest... |
I tried to write this code as concisely as possible. Is this the best way to do it?
def collatz(n):
"""
Generator for collatz sequence beginning with n
>>> list(collatz(10))
[5, 16, 8, 4, 2, 1]
"""
while n != 1:
n = n / 2 if n % 2 == 0 else 3*n + 1
yield int(n)
|
Can someone review my code? I am trying to implement radix sort in JavaScript.
var numbers = [90, 46, 7, 12, 100, 68];
var length = numbers.length;
var buckets = new Array(10);
Clear();
function Clear() {
for (var i = 0; i < 10; i++)
buckets[i] = [];
}
RadixSort();
function RadixSort() {
var maxElem... |
The following code is a function that works. It's just slow and I don't know how to speed it up. It takes an Excel row number and the value of its headerval (string) and finds the same headerval on a different sheet then copies the formatting and applies it to our new sheet. The true false is because the source sheet h... |
Motivation: Have std::vector<std::unique_ptr<T>> accessibility at std::vector<T> speed.
std::vector have one inconvenience - you can't store pointers nor indexes to elements if the vector grows/alters.
To overcome this problem we usually use vector of pointers / deque (if only grow) / list / etc. Having our elements in... |
I use this script in amazon lambda for image processing. Script should do:
download image and watermark from amazon S3
resize image to two sizes
put watermark on it and annotate with text
put resized and watermarked image to other bucket
send to external host some metadata info
At this moment it works as expected, bu... |
Original question
Reimplemented solution following JS1's answer.
Changed bit string hack to bitwise operations to get the corresponding base64 index values.
#include <stdio.h>
#include <assert.h>
void get_b64_quads(char *hex, char *b64quads, int pad)
{
char *dec_2_base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop... |
I have written the following the code to complete a matrix based on data provided in a second worksheet, but the code is really slow (note that s1=12,000, s2=40 and s3 = 200,000). Any suggestions on how to make this code faster?
Sub UpdateMatrix()
Dim wsOverview As Worksheet, wsData As Worksheet
Dim rngTable As Range
... |
The code for a binary search on an ordered string by alphabetical orders seems to work. I am wondering if there is a better way to write this.
function binary_search(arr, letter){
var first = 0;
var middle = Math.floor(arr.length/2);
var last = arr.length -1;
while(true){
var test = arr[last];... |
I'm working on my first NodeJS / Express application with the async module. It's been an uphill battle for me learning node (and even JavaScript) as I go along so I'm sure there's a lot of room for improvement.
I've written a GET event handler for my REST API and I'd like to know:
Where and how to decompose this into ... |
I wrote these extension methods to provide a generic/re-usable method for saving a form's size, position, and window state. What I would primarily like to know is if there is a better way to handle storing the WindowState property. I would also like to know if there are any bugs I might have overlooked, unnecessary cod... |
Problem URL
This is the solution I came up with the minimax problem stated above. I did a top-down recursive approach with memoization, and I think this should be \$O(n)\$, since we are filling out a memoization table with \$n\$ elements, with constant number of operations per each recursive call. Nevertheless, I am ge... |
I have recently written a Brainfuck interpreter in C#. I tested it with the examples given on EsoLang website. It does not handle errors right now.
Questions:
Even that it can run only one program at once, should I maybe put the variables into the class (create new class) or just leave them inside the BF method?
Shoul... |
I have the following code in Python which opens and closes a file in every iteration (using with keyword). In 95 % of iterations the file will be the same, so there's no need to open and close it again. Is it possible to optimize it if this optimization has sense?
import sys
import re
def createFileName(str, index, nu... |
Numbers are being stacked in the following manner:
7
4 8
2 5 9
1 3 6 10
The x-axis is horizontal and the y-axis is vertical. With that in mind, here are a few examples of the values and their coordinates:
2, 3 (coordinate) ==> 8 (value)
2, 2 (coordinate) ==> 5 (value)
I need to write a function \$fn(x, y)\$ which ac... |
I've written this program that, renders a circle in the middle of the screen. It's been written in a very elementary way.
Any suggestions on principles or techniques? Or any more optimal or efficient ways of drawing circles in C?
I'm using SDL2 (Simple Direct Media Library) and GCC to compile.
#include "SDL.h"
#include... |
I have written some code for mapping excel columns to table columns and processing data after mapping columns. Please review this code, check for SOLID, OOP principles and suggest any improvements and optimizations. Any critiques, suggestions or comments are warmly welcomed.
API Action Method to get table and excel co... |
As this will eventually become part of an operating system I'm developing, there is no specific adherence to any particular ABI, even though this is being developed and tested on Ubuntu 16.04. My OS will however adopt a SYSTEM V paradigm insomuch as passing values by register, but they will be passed in the one most su... |
So, I have an assignment due in a couple days where I need to create a card game.
I chose to do a memory game and I'm nearly completed however I'm completely stuck and not sure how to move all of the methods or functions into classes. Shuffle, cardFlip etc I'm wanting in classes but not sure on how to move them without... |
I was attempting a question on HackerRank-Dijkstra's Shortest Reach 2 and upon submission my programs times out in 3/7 test cases. One of the test cases had 200 nodes and about 2000 connections. Here is my code-
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.i... |
I am in the process of refactoring this simple binary search tree code responsible for adding new values:
void add_internal(Node *root, int value) {
// Decide whether to insert left or right
if (root->value >= value) {
// Decide whether to insert here or down the subtree
if (root->left) {
... |
I have made this pong game as a 1 player game, versus the computer. however it is impossible to beat the ai. Any ideas to make the code better would be appreciated.
import pygame
from pygame.locals import *
pointcounter = 0
class Pong(object):
def __init__(self, screensize):
self.screensize = screensize
... |
I am programming my first android app. It is going to be a quiz. It will have 40 different categories of questions and for each category I am going to have a SQLite Table, which holds the questions for that category.
I have a working DatabaseHelper for the first 2 tables. If I keep going like this for the next 38 tab... |
I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project.
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="" method="post" enctype="multipart/form-data">
<h2>Upload File</h2>
<label for="file... |
Write a program by creating an array of 9 integers that represent the
positions in the tic-tac-toe board. Once the array is created, assign
values to the board and print the contents of the board out. The
values for the board are:
Board Value: X, Integer in Array: 10
Board Value: O, Integer in Array: 100
Board ... |
I have in-house template like QList which creates a list of all objects of, say, Book.
This list contains many objects of Book. Book has member variable called BookTitle and in some cases objects have same value for BookTitle.
Now I am thinking of writing a function which contains objects of Book having unique book ... |
I'm working on a project that has an option to playing against Al, so I started to make it in a separate class and just extended the main class which has an object of a GUI class which draws the buttons and frames.
My algorithm works as follows:
Once a button is clicked:
Set the text to "X"
Check if player "X"(human) ... |
My code works but I don't believe its the most efficient way of doing it. I'm still learning.
Here is what the program requirements are:
Executable code will fall within a loop that continues to loop until menu item 3 is entered. The menu (see screenshots below) appears first, and what follows depends on which men... |
I've done this assignment here for my android programming course I'm taking. The exercise requirements were to create a single-activity interface for selecting a 'photo package' to purchase, and to select the payment method, and then display a short summary of the information (subtotal, sales tax, total cost, and sele... |
Inspired by this question, I decided to give it a try and implemented a brainfuck interpreter myself. It includes various improvements:
It's object-oriented and modular
Unlimited tape size
It includes a call stack (no seeking for opening parenthesis)
It allows stepping and debugging
It throws exceptions on errors
Tap... |
This is an iterative review. I asked for reviews on a Collatz sequence generator here. I tried to address all of the suggestions that were made.
I've added a new function get_longest_collatz(n), which can be used to solve Project Euler problem 14 (the question states: which number under a million has the longest Collat... |
I am working on an application which responds to different screen resolutions. At a certain minimum DPI, we want to apply a set of styles. We also want to apply that same set of styles if the class hidpi is present on the root html element. Our project uses LESS.
This is the code I inherited. I've replaced the styles w... |
Our senior developer gave us (trainees/jr. developers) a small exercise and that is to make our own Integer.toBinaryString(int n) implementation. This is the answer I came up with. I would just like to hear comments/suggestions/opinions on this. Especially, if there is a way to optimize my answer.
public static String ... |
I implemented a invert-range operation in a (logical) circular vector. A circular vector is a vector without a logical starting and ending object, or, equivalently, the successive element of the element at the last index of the vector is the element at index 0 (similarly for the previous element).
I'm not 100% sure it'... |
What I have
I am a bit advanced PHP developer, but now I'm going to college where we are learning Ruby. We got the first homework and I did it. But I wanna make great code - so I looked for standards and found pretty much nothing. I only realized, that variables aren't named with camelCase but_like_this. I edited some ... |
I am new to Haskell, and wrote a script to verify credit number.
I did some tests, the script worked, but can it be improved further?
isCreditCardNumber :: String -> Bool
isCreditCardNumber number =
0 == creditCardReminder ( creditCardDouble ( blowupCreditCardNumber ( reverse number)))
blowupCreditCardNumber :: St... |
This is a little assignment I am working on. I am a beginner Java programmer and would love some advice on how to improve this code.
For more context, here are the assignment details:
Create a complete program that has the ability to store and display
integer values in an array. The maximum number of values that yo... |
I'm making a Texas Hold'em game for multiple players. So far, I have finished the flow control for betting / calling sequences, player stack / pot updating, and just now - the part responsible for drawing cards and distributing them. It is this last part that I would like reviewed, if possible.
Essentially, I wanted to... |
A couple of model classes are doing the validation using FluentValidator. These model classes are used to Add and Edit the branch data and they are working well but I have no idea how to remove the code smell (duplication).
Problem: Notice the duplicate validations being written in BranchEditModel class as well. I have... |
I see a couple of these on codereview but I was hoping my way hasn't yet been encountered:
def is_palindrome_permutation(strng):
cache = set()
for char in strng.lower():
if not char.isalpha():
continue
if char in cache:
cache.remove(char)
else:
cache.a... |
Using DataTables (Table plug-in for jQuery) with server-side processing, I had to create filtering for my data with good performance. However, in my opinion it's kinda ugly, especially the part of (.Where(...)), where I have to manually compare each property with the search variable. Is it possible to make it better?
u... |
I can recently coded an emulation system and in this project I have a PacketHandler for each player connected to a socket server, and each player receives packets (data) from the client application.
Can someone please let me know if this code can be improved in any way? I will post the code below for the PlayerPacketHa... |
I've written a small PHP library to connect with an Instagram application. The repository is on GitHub Instagram-php. Here I am adding only main class code. I require a code review and thoughts on performance and security issues.
namespace Haridarshan\Instagram;
use Haridarshan\Instagram\Exceptions\InstagramException;... |
I wrote the following code for generating a table with random numbers and would like to ask if there is any way to optimize/enhance/modularize the JavaScript code, especially the addColumn and the addRow functions.
<body onload="initlization()">
<form>
<input type="button" class="button" value="Add Row" onclick="addRo... |
This is an extension of this question due to it not covering an important role of my setup that I think needs more attention.
The files are stored on a different server for separation and convenience.
I'm trying to store references to files in my REST API.
I'm using Django for my REST API and I need to find a convenien... |
I have been trying to write a sample code block to remove multiple backward or forward slashes from a path (e.g. //a//b should be /a/b; on Windows, c:\\a\\b\\\c should be c:\a\b\c).
I am assuming that:
Code must be platform independent
Should work in all cases (or report a proper error)
It should be readable and maint... |
After posting some of this code on Stack Overflow I was told to have a look here and get some feedback.
I am having fun building a light JavaScript framework and have copied this pattern. It works fine, but I like to have some review on it.
The reason that I was directed here is likely the use of CSSStyleDeclaration. I... |
I'm starting to learn C and thought it would be a good idea to try and implement some data structures. I started with a very simple stack and would like to hear some opinions.
Stack.c
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
struct Node {
int element;
struct Node* next;
};
struct Node* head;... |
I'm not really super experienced async/await and working with tasks, so I thought I'd ask for some other opinions.
I'm working with code written by someone else that establishes a TCP connection. It works most of the time. But sometimes it just doesn't, and the connection gets dropped and we don't know about it.
My fir... |
I wrote this Python script as a utility script for me. It's something that could be achieved in a simple shell script or alias, but it wasn't 'verbose' enough for me in that format, or customizable.
This script, basically, is just designed to take and process whether a specified DNS TSIG keyfile (necessary for 'signed... |
This is a new discussion from this post (Find the shortest whole repetitive substring) and since it is totally new code, I post as a new thread here.
The major initiative of posting a new thread is, RobAu has posted a smarter idea, and there is no implementation, and I implemented the ideas and has simple prove the ide... |
The problem I want to solve is very simple:
Given a string s and a string t, check if s is subsequence of t. there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100).
Example 1:
s = "abc", t = "ahbgdc"
Return true.
Example 2:... |
My code is a general solution to the following problem from Project Euler #12:
What is the value of the first triangle number to have over five hundred divisors?
MY CODE
#include <iostream>
int generate_triangular(int n);
int enumerate_divisors(int n);
int main()
{
std::cout<<"You want to find the first triangula... |
Working on the problem of sum game. Suppose we have consecutive numbers from 1 to n, and an expected sum number, there are two players, and each player tries to select one number in turn (once a number is selected by one player, the other player cannot select it again), and the selected numbers are summed together. The... |
My problem starts with a list A (length around n = 100) of big strings (around 10000 characters each). I also have another q = 10000 strings of length 100. I want to check if each string is a substring of any element of the list A.
I've tried to do this using inor any but it is still taking too much time as there are 1... |
I've made this little animation using SVG, CSS-keyframes and a bit of Sass.
html,
body,
.wrap {
height: 100%;
}
body {
background-color: #efefef;
}
svg {
max-width: 500px;
width: 100%;
height: 400px;
position: absolute;
margin: auto;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
circle {
position: a... |
I've got an assigment where I have to print all the Pythagorean triples smaller than a given n. Even though I could print them directly in pythagoreanTriple function, I decided to structure everything, as I want to go deply into programming structure.(my teacher does not teach us a lot, so I'll have to study on my own)... |
I wanted to start contributing to the Open Source community, and decided to release some of the Python tools I have written awhile ago. The problem is that I am not really familiar with good practices, and would really appreciate any advice and/or pointers you guys could give me.
The code below is a package to visualiz... |
I generally work in Python for programming competitions, but I'm teaching myself Scala. As an exercise, I've attempted Project Euler problem #12 in Scala. I hope that somebody familiar with Scala can point out anything I'm doing which is not idiomatic in "functional style" Scala. My code produces the correct result, an... |
The following problem has been written using TDD. Please review the following:
Unit tests
OOP
Design Principles (SOLID)
Cleanliness and naming
Anything that could make the program better.
Problem Statement:
Taxi Meter Company has to develop an app for their business. The app calculates the bill based on the car type... |
I'm new to Observables. I'm using them to check if the user is logged in or not in the constructor of my root page.
I have nested many Observables in order to do this, and they are working fine, but I think that there is a way to flatten all of these nested Observables.
I just want you to review the code and let me kno... |
This implementation is inspired by the POSIX functions sem_wait() and sem_post(). It tries to get rid of busy loops in the code and appears to work after some simple tests that have been done. But code involving concurrency is hard to get right. Hopefully, there are no race conditions and/or deadlocks in it.
Update 1
s... |
I'm new to Rust and trying to convert some Python to Rust. I have the following in Python:
>>> v = ((0, 0), (1,1), (2, 2))
>>> strings = "\n".join(("%s: (%s, %s)" % (i, val[0], val[1]) for i,val in enumerate(v))))
>>> print(strings)
0: (0, 0)
1: (1, 1)
2: (2, 2)
I'm trying to find the best/smartest/most rustic way of... |
Recently while practicing I came across this problem , here is an excerpt from it,
A permutation of the numbers 1, ..., N is a rearrangment of these
numbers. For example
2 4 5 1 7 6 3 8
is a permutation of 1,2, ..., 8. Of course,
1 2 3 4 5 6 7 8
is also a permutation of 1, 2, ..., 8.
Associated with ... |
Mainly for practicing purposes, I'm trying to implement a simple, yet efficient memory pool. It's basically a linked list that is able to grow, with fixed sized members. Each node has a flag if it's free or not. I'm not sure if I'm doing it the right way, and especially confused about how to deal with alignment, and th... |
I've been learning C++ for about a week now. My primary language is Python, so I thought I would find some code to translate to figure out how the pieces fit together. Please let me know any simplifications/best practices!
There is an assignment on a unit of Udacity's "Artificial Intelligence for Robotics" where you ha... |
I wrote a shell script to authenticate users connecting to an OpenVPN server. When a user attempts to connect, OpenVPN executes the script with the username and password variables sends.
The script then sends an HTTP request to a web server that either returns a status code of 202 upon success and 401 on failure.
I wou... |
The program asks for a user to set the max number of the range. That number is used to set the max range of a randomly generated number. The program keeps track of the number of guesses. I have taken a couple classes recently on different programming languages. I wrote a Hi/Low program in C a while back and decided to ... |
Is it a bad practice to use getters and setters this way?
Below is my code:
public struct Settings
{
public static int workMinutes
{
get
{
return Properties.Settings.Default.workMinutes;
}
set
{
Properties.Settings.Default.workMinutes = value;
... |
I've written a program that runs through a matrix of numbers, ranging from 0 to 2, and stores the results in a 2D vector.
I'm using the values in the 2D vector as the profile for a tile map for a game engine.
I want this to be optimal, and as this is my first attempt at it, I doubt that it is but it does work as is.
... |
Based on responses to my question posted here, I've built a full implementation of a Location object. Such an object can be used to build a map for a text-based adventure game.
Feel free to review the code, leave some comments about the good and the bad of what you see.
Things to notice
Objects of this class can only b... |
I have windows form application. One button event starts the script via object called ScriptStarter. The status of object is used to pass message and color to UI (toolStripStatusLabel1). I'm not sure if this is good practice. Could you please give me advice or suggestion how to better set up the communication between o... |
I'm writing a class that acts as the base for almost all objects in my project. I know this class technically doesn't represent a tree structure, because it can have more than 2 children. What should I change? Should I be using smart pointers? I'm a self-taught C++ programmer, so I've got much more to learn.
Here's the... |
I want to learn C# and have started off with making simple Pong game. I would like to ask you whether the approach I took is correct, as in it is readable and fits the conventions/standards. Maybe some of the implementations I have made (more like for sure) are far from optimal or not complete, probably some things are... |
I wrote this code to implement a data structure in C++. It works perfectly, however, I am looking to improve its efficiency. Also, I'm just getting started in C++ so using code to explain your suggestions would be incredibly helpful.
Here is the class that implements the data structure:
class key_value_sequences {
publ... |
This function returns true if the string contains zero or one periods, and returns false if the string contains more than one period.
bool isStringValid(std::string str){
std::size_t pos = str.find('.', 0);
if(pos != std::string::npos){
pos = str.find('.', pos + 1);
if(pos != std::string::npos){... |
I am a beginner Java programmer and I have just finished creating a simple 2 player TicTacToe game and would appreciate some feedback/advice on how to make it better.
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class TicTacToe implements ActionListener {
publi... |
I made this as a practice application to learn React. It is simply a box where someone can enter their name and a comment and submit it, and display other comments. This animated GIF illustrates what it looks like:
Note: Please don't be too critical of the looks, I haven't spent a lot of time styling it with CSS. Als... |
I'll need to build a syntax tree (AST) for Rubberduck, but since VBA has dozens of tokens and complex rules, I needed a simpler language to play with first, so I thought BrainFuck would be a perfect candidate.
The result is completely overkill for BF, but the exercise was very educational.
Lexer
The lexer reads the co... |
This is a binary-to-text encoder that is based on Base64, but it works by converting data into an almost pronounceable string (consonant-vowel-consonant-vowel for each 3 bytes). Any improvements, suggestions, etc. are welcome.
bitspeak.hpp
#ifndef BITSPEAK_HPP
#define BITSPEAK_HPP
/*
Encoding:
******** ******** *... |
I'm writing a service that receives a list of Latitude/Longitude objects, prepares them for transaction, and then calls a web service to write them to the organization's Mainframe. According to the existing application that I'm replacing, the Mainframe can only accept "chunks" of up to 5 Lat/Long values at a time, how... |
Below is the program to find k-complementary pairs: K = A[i] + A[j];.
package org.test;
import java.util.HashMap;
import java.util.Map;
public class ComplementaryPairs {
public int noOfComplementaryPairs(int arr[],int k){
int result = 0;
for(int i=0;i<=arr.length;i++){
for(int j=i;j<a... |
The boot loader that I'm designing is just simply going to setup (A) Stack, (B) Segment registers (C) Load remainder of track for specified device. Conventionally, this could have been up to 4 floppy and/or fixed disk devices, but now, it may be an FDC, but most likely USB or fixed disk. As my boot sector does have an ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.