instruction
stringlengths
71
71.9k
I'm working on a small final fantasy type game. I have this for a tile map. I was just wondering if this is a good way to do this or if anyone has any suggestions, I would love to read them. import com.stardust.main.gfx.Assets; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.BufferedReade...
A coworker, from a past programming life, called me up last week and asked about Trim Functions in COBOL. I sent her these PEFORMed "functions", which I've had lying about and without any professional opportunity to use them. It's been my experience that most Cobologists working within their shop standard don't twiddle...
I tried to tackle #17 problem on Project Euler: If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are \$3 + 3 + 5 + 4 + 4 = 19\$ letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? I tried t...
In my data structures and algorithms class, we were introduced to the splay tree, a BST with the additional property that recently accessed elements are quick to access (because they stay at the top of the tree until a different element is accessed). I know that std::map uses a BST; I heard it's a Red-Black Tree. Anywa...
I have a "cumulative" lookup array for a custom collection view layout. The idea is that I have an array of rectangles, each with an index. The index is not unique, and is monotonically increasing. I need to create a lookup table, such that given a cell index, it returns the accumulated height of all rects lower than ...
The code is for a 4x4 Sudoku solver. It works fine when there are a small number of unfilled spaces (0's) but when I give the whole matrix input as 0's or so the solver takes a very long time. I need it to give only the first valid output, no need to calculate the rest of the outputs. I input a matrix with values from ...
Please review my simple Stack: template<class T> class Stack { public: Stack() = default; Stack(std::initializer_list<T> i) :n{} { for (auto& x : i) { elem.push_back(x); ++n; } } Stack(const Stack<T>&) = default; Stack(Stack<T>&&) = default; Stack& operato...
A while back I was asked the following question in a phone interview, and to be honest it stumped me. After many long nights of rolling the problem around in my head I think I came up with a decent solution. The Question: Given a list of intervals like: [(5, 7), (11, 116), (3, 6), (10, 12), (6, 12)] Write a function ...
I'm pushing myself to learn pure JavaScript, so this morning I wrote an equal heights script in jQuery and then converted it to JavaScript. It works, but I'm using two for loops. Is there a better or more efficient way to write this code, maybe by finding a way to remove the second for loop? I've created a jsfiddle to ...
My code works fine and I would like to know if I chose the best strategy to implement my code, or if It can written better (more fast, more clear, best use of design pattern, etc). In my android application WelcomeActivity, in the onCreate method, I start a really simple service that load data from a file: public class...
I am working on multithreading project and I am using ZeroMQ socket to send the data as a byte array. Below is my example which works fine. I'm opting for code review to see whether it can be improved by adding a wrapper class for using ZeroMQ socket as some sort of socket manager. public class TestDriver { private...
A Python script for automatically extracting an archive file in a subfolder: #!/usr/bin/env python3 // sub7z.py import subprocess import re import os, sys, pathlib class Counter: counter = 0 def getCount(self): self.counter = self.counter + 1 return self.counter class ZipFile: pattern1 ...
Reffering other "Stack Exchange" Sources, I've been told that the only way of swapping BGR to RGB involves buffering. While this isn't true, I could just perofrm a quick C-SA algorithm on fseek or bmp buffer byte offsets. I wrote a fast implementation of fwrite, that swaps the first byte with the 3rd. I do believe that...
This code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, in Java, to provide an Iterator over Path objects which must only be directories, recursively, and where the number of returned instance number in some sufficient quantities to trigger an Out...
This is a Python script for counting the lines of a compressed file: #!/usr/bin/env python3 import gzip, bz2, zipfile, os, sys def openZip(zfile): f = zipfile.ZipFile(zfile) firstFile = f.filelist[0].filename if firstFile.endswith("/"): raise Exception("This zip file contains a directory.") re...
The JSON standard uses double quotes for key names and string values, such as the following: {"one":1,"two":"two"} However, the current project I am working on requires JSON-encoded objects to use single quotes instead of double quotes. (In this case {'one':1,'two':'two'}). Right now, there is no reasonable way to get...
I am trying to solve this problem using Clojure: You are given a list of \$N\$ people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic or they are not. Find out the maximum number of topics a 2-person team can know. And also find out how many teams can know that maximum num...
I have a scroll event and add class and remove classes for different elements. As you can see the code is a bit big. Is this method ok or is there a more efficient one? I mean, you can see that there are no child elements. I could use .siblings() for some but, as you can see, I also serve unique classes. Any idea? I kn...
We ran a Code Retreat day at Hacker Paradise this Saturday, and I was pretty happy with my eventual solution. It's written in Ruby, but would work reasonably well in JS/CS and is (hopefully) reasonably readable across languages. module Enumerable def bag # [1,1,1,1,2,2,3] => {1 => 4, 2 => 2, 3 => 1} # simila...
This is my implementation of recursive merge sort, using sentinels: #include<stdio.h> #include<stdlib.h> #include<limits.h> void merge(int a[], int p, int q, int r) { int n1,n2; int i,j,k; int *l,*m; n1 = q - p + 1; n2 = r - q; l = (int*)malloc(sizeof(int)*(n1+1)); m = (int*)ma...
I'm taking a design workshop and we've received a short task: To parse an input file of processor jobs. To simulate scheduling of those jobs on a parallel computer (each job needs X processors) The scheduling should be FCFS but it should be easy to to swap it out for a different scheduler. I wrote the code in C# (in...
I have HTML code like this : <a class="btn btn-default" href="#" id="addTxt">Add Text</a> <div id="nF"> <div class="form-inline"> <div class="input-group"> <div class="input-group-addon"><i class="fa fa-text-width"></i> </div> <input class="form-control" id="project_compo...
I need to iterate through a couple million essays that are about 500 words long and for every essay & I have to return the character is repeated the most. I have the following code but to iterate through 1 million essay (I have the same essay hard coded). It takes almost three minutes before it has a collection of all ...
I am a long time imperative programmer (mostly C++) taking my first forays into functional programming with Scala. I am following some online tutorials about functional programming and Scala and I'm trying to piece what I've learned into a representative example (the kind of thing I might do in my day job as a game pro...
Input is 1,2,3,4,5,6,7,8 If rotateOrder = 2 Output should be 7,8,1,2,3,4,5,6 If rotateOrder = 3 Output should be 6,7,8,1,2,3,4,5 Here is my program to do it: int [] unOrderedArr = {1,2,3,4,5,6,7,8}; int orderToRotate =2; for(int i = 0; i<orderToRotate; i++){ for(int j = unOrderedArr.le...
I am currently building an Excel calculation engine. Its purpose is basically to wrap the calculation logic of an Excel workbook in order to use the logic from a C# library. using (var s = new Spreadsheet()) { s.AutoCalculate = false; s.LoadFromFile("D:/workbook.xlsx"); // Example: Set B36 to 1000.0 s...
For the problem statement shown below: Part II(b): Your run-length encodings will only be useful if other classes have the ability to read them after you create them. Therefore, implement the nextRun() and restartRuns() methods. These two methods work together to return all the runs in a run-length encoding to...
Please review the use of pointers and design in graph construction code and its depth first traversal. I haven't used smart pointers as I want to understand any issues in following implementation with raw pointers. Graphs.h namespace DS { struct Vertex; typedef std::list<Vertex*> VerticesList; typedef std:...
I have this solution for Codility's PermCheck problem. In summary, the task is to check whether array A contains each number in \$1 \ldots N\$ exactly once. I got 100% for it but I got a time complexity of \$O(N * log(N))\$ or \$O(N)\$. How could I make this code \$O(N)\$? Could you also give a brief description of wh...
I'm making an app with a Flask API backend using a Flask-Peewee ORM and an AngularJS frontend. The Flask-Peewee ORM doesn't support token based authentication, so I decided to try to implement this myself. This is quite a bit beyond what I usually do, and I have in fact no idea whether this is secure or not. It does w...
As it is going to be used as part of some automation and not just at the command line I was wondering if it could be improved at all. Improve would mean any of: handle sad cases better handle error better report errors better better able to work on multiple linux OS including OSX Improve would NOT mean: shorter co...
I have completed this assignment from Stanford CS108 on MySQL and Swing (it's part B). It would be wonderful if someone could point out my weak spots in the code and overall design. I have uploaded code on GitHub. Task: In this part of the assignment you will create a GUI-based (Graphical User Interface) applicati...
I have my PDO Wrapper class and would love to get some more tips/opinions about what you think. This is my first class and I basically put my time into making it as logical and standardized as possible. I know I need to add comments. <?php /* COPYRIGHT © SIMPLEBB.NET CREATED BY: MikeM. CREATED IN: 2014 ...
I'm trying to create an observer pattern that the subject notifies the observers with different notifications. Normally in observer pattern implementations you can see only one method called notify where it notifies the observers that something happened and has a kind of inversion where the observer holds the pointer o...
Here is my JSON in which I have only three reportRecords just for demonstration purpose but in general sometimes we are getting pretty huge JSON, then it doesn't have three reportRecords only, it has large number of reportRecords. { "parentRecords":{ "reportRecords":[ { "min":1.0, ...
In this exercise I have to do this: Modify the program so that no matter what number the user thinks of (1-100) the computer can guess it in 7 or less guesses. I'm just a beginner in Java and I'd like to know what you think about my code: public static void main(String[] args) { Scanner in = new Scanner(System.i...
This is a simple guessing game where you are prompted for a minimum and maximum value, then you must guess the number the computer chooses! This is the first program I have written so any and all suggestions are welcome. def guessinggame(): print "Welcome to the Guessing Game!." while True: try: ...
Take a look a this service method: public static void CreateSocialEvent(int employeeId) { using (var dbContext = new EmployeeEntities()) { using (var transaction = dbContext.Database.BeginTransaction()) { try { // I would prefer the next two statements to ...
I have a function that I use to display a relatively large amount of data to the user: public function getAllProfileData() { $sql = "SELECT * FROM user_data WHERE user_id = :user_id"; $query = $this->db->prepare($sql); $query->execute(array(':user_id' => $_SESSION['user_id'])); $user_data = $query->fet...
I am trying to import a .csv file and save data in objects for later manipulation in Python. I am very new to coding so please do let me know my fundamental errors. import csv import os import time import numpy import itertools def __init__(p): p.playerFile = csv.reader(open("dk.csv", "rb")) p.playerLi...
I have started to learn JavaScript over the last few weeks. I have gone through most of the Head First JavaScript Programming book and it has been fantastic. I highly recommend it! Anyways, I found a cool little project that I wanted to attempt to make a script for. After a few hours of learning, adding and bug squashi...
This is a Python script I wrote to generate a SVG animation of falling leaves. How can I simplify my script and also make the animation look more realistic? import xml.etree.cElementTree as ET from math import sin import random # author Kyle Kersey # configuation leaf_count = 30 min_fall_duration = 10.0 max_fall_dur...
I am working on something that involves the observer pattern. A simple version of that looks like this: private var listeners = Set.empty[A => Unit] def addListener(listener: A => Unit):() => Unit = { listeners += listener () => listeners -= listener } In my code I have something that deals a bit more abstract wi...
Originally I posted this incorrect attempt - Searching a Join List for an index. Given a JoinList: data JoinList m a = Empty | Single m a | Append m (JoinList m a) (JoinList m a) deriving (Eq, Show) where m represents the size of the JoinList, find the element (Maybe a) at the g...
In the same vein as the (+++) function on JoinList and indexJ on JoinList, I implemented dropJ to drop elements from a JoinList. Here's my attempt: dropJ ::(Sized b, Monoid b) => Int -> JoinList b a -> JoinList b a dropJ _ Empty = Empty dropJ i jl | i <= 0 = jl dropJ _ (Single _ _) = Empty dropJ i (A...
Over the past year I've quietly developed a library for checking method preconditions. The project is hosted at https://bitbucket.org/cowwoc/preconditions/ I would like to get your feedback on the design and gauge whether this kind of library is of interest to anyone. Sample usage looks like this: public class Dog { ...
In our .NET tests we use NSubstitute & ExpectedObjects. Testing object expectations involves hand crafting large anonymous objects and when new properties are added we need to go back to these anonymous objects & update them. Attempting below to get a fluent Object to DTO builder - which fails when a property is missed...
In order to learn the basics of Monte Carlo I calculated pi with it. I also wrote an explanation of the reasoning behind the code. Down here you can see the circle with random points that I simulated in my code. """ This programme calculates pi with Monte Carlo Given a square and a circle inside it. We have ...
I've made a dropdown menu using angularJS, it works fine but I feel that I'm not following the DRY principle. Is there a way to combine this switch statement into something more efficient with less code? Instead of having 3 "cases" can I just use an OR operator inside of a data-ng-switch-when or something like that? Th...
I have a result class which wraps another object if successful or an error if failure public class Result { private Result() { } public bool Success { get; private set; } public string Error { get; private set; } public MyClass MyClass { get; private set; } public static Result CreateSuccess(MyCla...
I am using jsTree v1.0 (latest v3.0, they withdraw support from older versions) to display the hierarchy in my application. It was good until until I started showing groups/user up to 200 levels, but now I have a new client which has levels as big as up to 5000, so this code is taking too long to execute. I have two op...
I've been building a PDO PHP DB class and I just wonder if someone could give me some feedback (regarding security, how the code is written and how I can optimize it). This class is not finished function wise, but I would like the code I have currently to be reviewed. <?php Class DB { public static $init = null; ...
Problem A: Vincenzo decides to make cube IV but only has the budget to make a square maze. Its a perfect maze, every room is in the form of a square and there are 4 doors (1 on each side of the room). There is a big number written in the room. A person can only move from one room to another if the number in the next r...
I've written a determinstic & non-deterministic finite state machine. I've scrubbed the code quite a bit but I wonder if it could perhaps be scrubbed even more. Suggestions for code clarity, formatting, API design and test suites (I can't think of any for my NFA) would be welcome. Also, can the code be modified to supp...
I have written the following code to decompose a number into primes. The problem is that it takes so much time and I have no idea why. #include <stdio.h> #include <stdlib.h> int prime (int n){int j=2; if (n==2) return 1; while(j<(n/2)){ if(n%j==0) { return 0;} j=j+1; }return 1;} int expotent (int n,int p){int j=0; w...
Implementation: This works based on this observation: $$a^n = a^{n/2} * a^{n/2}$$ BigInteger Pow(BigInteger x,int n) { if(n == 0) return 1; else if(n % 2 == 0) { var val = Pow(x,n/2); return val * val; } else return x * Pow(x,n-1); } How can I improve this? Is there a more efficient alg...
Please review my Stack using linked list: template<class T> struct Node { T item; Node* next; Node(T t = {}, Node* link = nullptr) :item{t}, next{link} { } ~Node() { delete next; } }; template<class T> class Stack { public: int size() const { return n; } bool empty() const { return n == 0; } ...
The AsyncTask available in android, gives you the result from doInBackground on the UI thread so that you can update UI according to the result, but exceptions need to be handled inside doInBackground function. So following is my generic solution to the problem, the main objective here is to allow user to handle except...
I am fetching or querying all the entries from my database (core-data) at three different times in my code, which I find to be an inefficient approach to writing the code. The method _walks = [[DatabaseManager sharedDatabaseManager] getAllWalks]; helps getting all the entries from the database in the form of NSArray. ...
I am having difficulty optimizing my code for the Sieve of Eratosthenes. The code works fine for smaller numbers (up to 10,000) but takes a long time to run for numbers over 100,000. import java.util.Arrays; import java.util.Scanner; public class SieveOfErasthostenes { static int num = 1; static int count = ...
I have known about unit testing for a while now, but I am just now finally understanding how to implement it. I think that my initial implementation is a little rough so I could use some feedback. I have implemented these tests in order to verify that a new feature of my strategy game is working properly. Previously,...
I tend to write code, with very few comments, and few line breaks. I'm currently just a student at a University. I've had professors tell me one way or another to comment, but I have a hard time with more ambiguous tasks. I have a misc. snippet of code, written by me in C++. I'm not looking for revisions on it or anyth...
I have only been working with C for a couple of months and I think I have a pretty good function to insert a node in the front of the circular doubly linked list. I have tested in adding several nodes to it, but would like some feedback. struct used in functions: typedef struct TCB_t { struct TCB_t * next; st...
I'm writing a program that will compute a continued fraction expansion of a number. I've been learning Racket/Scheme for a few weeks and I wanted to see what I can do better. Usage: This program takes computes an arbitrary number of terms of the continued fraction of an algebraic number (the root of a polynomial with r...
I'm building an Android app and I'm new on building the UI on an .xml file. I've built a simple layout but I think that is not optimize very well. This component is a search layout with 2 edittext and 2 buttons. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res...
I'm currently in the process of learning JavaScript and what it has to offer. I thought writing a simple web app that would allow me to add/remove/show my favorite movies would be a nice learning experience. I'm curious as to what the best solution would be for an object to house all of the data. It would be triggered ...
I've done the difficult dailyprogrammer challenge #2: Your mission is to create a stopwatch program. this program should have start, stop, and lap options, and it should write out to a file to be viewed later. I wanted to see from you guys if what I did was correct. I'm looking for shortcuts or better coding practice...
Here's the API my teacher assigned: and here is what I came up with: class MyMap: def __init__(self,size=10): self.size = size self.internal_list = [None] * size def _getHash(string,size): total = 0 for ch in string: total += ord(ch) total = total % size ...
I'm learning promises and now I'm trying to figure out if something in this code can be improved. This code is expected 3 urls and then async parallel calls should be done. When all requests are finished thet just show each request's data. const hyperquest = require('hyperquest'); const BufferList = require('bl'); cons...
I have a controller that has gotten a little out of hand. This is my first AngularJS project and I am using it as a learning experience... but I feel like I am doing some things wrong. This controller is used for resetting data on a weekly basis. There are "foos" of which 10 random foos are selected each week, "bars" w...
I am studying mutual exclusion in college, and we just covered the producer/consumer problem. The class does not involve writing code, but I decided to implement a bounded buffer version of this problem. I have never written a multi-threaded program before, nor have I written a program with mutual exclusion before, s...
I have states that have a requiredlogin object set as true, then I have Angular listen on stateChangeStart, but things end up pretty ugly. Here is a state that requires a login. I think this actually pretty good and simple. .state('dashboard', url: '/dashboard', templateUrl: 'partials/dashboard/main.jade', data: ...
This is my first nontrivial Haskell program: module Main where import qualified Data.Map as Map type Env = Map.Map String Expression data Expression = Constant Integer | Variable String | Add Expression Expression | Multiply Expression Expression | Let [(String, Expression)] Expression | Lambda String Exp...
Any ideas on making my code a bit more clean and efficient? Any criticism is appreciated. I don't like that I'm calling my lengthy DeepCopy method so many times, but the BinaryFormatter approach is much much slower. I haven't come up with a better approach than doing a deep copy of the entire SudokuBoard due to all of ...
This code is not live, but for brevity I'll write as though it is. When a user clicks any element with the class name js-modalOpen, for example: <span class="js-modalOpen" data-modal="signup">Sign up</span> A modal appears. The contents of that modal's dialog are determined by data-modal. All modal contents live as sn...
I have a class that I use to communicate with some hardware equipment (a step motor to be precise): public class HdCommunicator : IDisposable { private TcpClient client; public HdCommunicator(TcpClient _client) { client = _client; //create and start the listener Thread t = new Threa...
I have this app, that gives you cigarettes through the day, with equal intervals from one another. These are some important variables: wakeUp - is the time, when you wake up in the day, and if the user has specified that he sleeps 8 hours, than the wake hours are 16, and the cigarettes must be distributed evenly for t...
I have programming this importing and exporting of animation keys. It is working, but I would like to gather any feedback/advice as I am still pretty much a noob in coding. import maya.cmds as cmds from PyQt4.QtCore import * from PyQt4.QtGui import * class mainWindow(QDialog): def __init__(self, parent=None): ...
I have the following code; whereas currency and views are in reality many JSON objects from an SAP export, that I can not rely upon to be in the same format. That is why I'm regexing over these inputs. My code looks clumsy to me. Can it be improved? var currency = "20.002,03 €"; // sometimes this String is "-" or " " v...
Is it wrong? Should I have these 2 classes in separate files? public interface InternetDependentFlow { void onInternetIsAvailable(); void onInternetIsNotAvailable(); public static abstract class InternetIsAvailable implements InternetDependentFlow { @Override public final void onInternetIsN...
I made a program, but I not happy with the quantity of code. The end result is good, but I believe it can be made much easier, only I don't know how. The functionality: If equal items > 1 in list, then assign all equal items a unique set number. Below I made a unit test. I'm not happy with the class CreatSet. Can som...
So I made this program, where you can add a recipe which is saved as a json and you can get a plan for your meals and a grocerylist back. """Program that help you to decide what to eat for the week You should start adding some Recipies and ingredience you need for the Recipie. If you have at least 7 of them they ...
I've spent the last weekend working on this basic block building game, which I'm quite proud of. I do think it can be improved in many places though, e.g, performance issues due to my badly designed tile loading, etc. etc... /** Here are few instructions before you start... * IMPORTANT (ON KHANACADEMY ONLY): When you...
I have a regex sequence that will take the end of a file path and select it for me: resources/services/dealerInfoRequest/V5-0/dealerInfoRequestManager.cfc In this, the regex would select: /V5-0/dealerInfoRequestManager.cfc` In some cases there is no V5-0 and it's just the file name and extension. My regex is worki...
Your program is to use the brute-force approach in order to find the answer to Life, the Universe, and Everything. More precisely, rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits. I was solving this problem and I ...
I'm aware that there are existing questions about JButtons, but I haven't found anything that's asking exactly what I'm trying to figure out. I inherited a Java project that has a horrible structure; my job is essentially to go through and fix it. The project includes a GUI, which is where this question becomes relevan...
I have a class that has a std::vector of pointers, I'm NOT going to give any of those pointers to objects outside of it, I mean, I'm not going to share the pointers. - I was reading that isn't everywhere that we will use smart pointers and that raw pointer isn't useless as long that someone is responsible for deleting ...
I am working on a project that has to parse through a text file and perform validations on certain fields in the file. Some of the validations are basic (i.e. data types), and other's are a little more complex (i.e. field 1 must be x if field 2 is y). There is a requirement that this be done in SQL Server. I have a C#...
After the tips from my previous review. I have come up with these changes: Changed my braces to start on a new line Used the Single Responsibility Principle Return early whenever possible Use a namespace that doesn't start with an underscore I'm not entirely sure I have used the namespace correctly. If it's wrong, c...
In my rails controllers, I am consistently using this logic: def report dump = params[:dump] ? params[:dump] : 'false' data = {} if dump != 'false' return render :json => p(data) end end Is there a better way to write this? A ternary operation is just an eyesore. I thought maybe just using the || oper...
I have a limit of 100 sessions (each session held in an object). Many threads will be requesting sessions, and it is very possible that all 100 sessions could be in use at any time. I'm a Junior Developer. I saw the Object Pool pattern and decided that it looked appropriate. What do you think? If no sessions are avaibl...
I have written a function to populate values into a class whose structure is as given below public class Country { public string Name { get; set; } public string Continent { get; set; } public string Zone { get; set; } public India IndiaInfo { get; set; } } public class Ind...
I was asked the following problem: What is the smallest positive integer n that can be written as a sum of three positive cubes in at least 12 ways? Can this be coded better way such that it is easy to compute the smallest positive integer that is sum of m nth powers? I'm not a professional programmer, so I managed o...
I created a function for giving me percentages from two integers. I want two decimal places in the result. def percent(num1, num2): num1 = float(num1) num2 = float(num2) percentage = '{0:.2f}'.format((num1 / num2 * 100)) return percentage It works, but I doubt it's very pythonic (since I have no idea ...
This a program I wrote to execute various power-related function on my computer. It accepts one command-line argument that describes what action to take and then performs that action. Usage looks like this: C:\Users\Noah\My Code\GHCI> power sleep execute sleep? (y/n) y //computer goes to sleep Here's the code. Any fe...
I'm reworking PyCXX (C++ wrapper for Python). I'm currently examining the following macro code, and wondering whether there is a way to write it using templates rather than macros. If so, the question becomes: what is the best way to write it? (I personally favour a concise macro solution over an awkward template solut...
For my Matlab class I'm taking, I was given the task to write a function ReadAndCountWords that takes in the name of a text file (specifically from this zip file) as an input argument and then prints out the words contained in that file in order of how many times the word occurs. The function doesn't have to produce an...
I've been making a program for an assignment that converts fractions to mixed numbers, and I'm done, but I was wondering if I could simplify it in any way, since it seems quite complicated right now. Also, keep in mind that I am not allowed to use any Math or String methods to do this assignment, and I can only use +, ...
This program takes lines of input. The first line is an int specifying how many further lines will be input. For the following lines (comprised of characters a-z), it will be determined whether removing one character from the line can result in the line being a palindrome. I know this can be substantially improved, but...
In order to make my life easier with parsing some VBA code, I have written a few extension methods to extend the string type, and put them in this StringExtensions class: [ComVisible(false)] public static class StringExtensions { public static readonly char StringDelimiter = '"'; public static readonly char Com...