Skip to main content

Posts

Featured Post

Your First Programming Language

What programming language you start with really all depends on where you want to go with programming/coding. The great thing about this field is that there are an absolute abundance of smaller fields that you can go into, all using programming in their own unique ways. For web applications, a good start would be with HTML and later moving your way through CSS, JavaScript, JQuery, PHP, SQL, and any of the JavaScript libraries. Ruby is also a popular choice, so I would recommend checking that out too. For more scientific fields or areas with more machine learning and A.I., Python is generally a great place to start as it is widely used in that field of study. C++ is also a very useful language to know for that, but it can be a little more challenging for beginners. For game and application design, languages such as C#, C, Swift, Kotlin, and Java are most often used for that.
Recent posts

Everyone's A Winner

Description Today's challenge comes from the website fivethirtyeight.com, which runs a weekly Riddler column. Today's dailyprogrammer challenge was the riddler on 2018-04-06. From Matt Gold, a chance, perhaps, to redeem your busted bracket: On Monday, Villanova won the NCAA men’s basketball national title. But I recently overheard some boisterous Butler fans calling themselves the “transitive national champions,” because Butler beat Villanova earlier in the season. Of course, other teams also beat Butler during the season and their fans could therefore make exactly the same claim. How many transitive national champions were there this season? Or, maybe more descriptively, how many teams weren’t transitive national champions? (All of this season’s college basketball results are here. To get you started, Villanova lost to Butler, St. John’s, Providence and Creighton this season, all of whom can claim a transitive title. But remember, teams beat those teams, too.) Outp

Puzzle Me This

Description First they took our jerbs, now they're taking our puzzles! (with your help) Today we're gonna find a way to solve jigsaw puzzles using computers Input Description As I am no designer the input will be purely numerical, feel free to make some visual version of the jigsaw puzzles :) You will first be given the dimension as X, Y Afterwards you will be given list of puzzle pieces and what type their 4 sides connect to (given as up, right, down, left) Their side-connection is given as a number, They connect with their negated number this means that a 1 and -1 connects, 2 and -2 connects etc. 0 means that it doesnt connect with anything. Assume pieces are rotated in the correct direction. fx: 2, 2 0: 0,1,2,0 1: 0,0,2,-1 2: -2,0,0,2 3: -2,-2,0,0 Output Description Output is a 2D picture/matrix of the pieces in their correct position for the example this would be 0 1 3 2 Challenge Input Challenges are generated, so there is a slight chanc

Continued Fraction

Description In mathematics, a continued fraction is an expression obtained through an iterative process of representing a number as the sum of its integer part and the reciprocal of another number, then writing this other number as the sum of its integer part and another reciprocal, and so on. A continued fraction is an expression of the form             1     x + ----------                1         y + -------                   1             z + ----                  ... and so forth, where x, y, z, and such are real numbers, rational numbers, or complex numbers. Using Gauss notation, this may be abbreviated as [x; y, z, ...] To convert a continued fraction to an ordinary fraction, we just simplify from the right side, which may be an improper fraction, one where the numerator is larger than the denominator. Continued fractions can be decomposed as well, which breaks it down from an improper fraction to its Gauss notation. For example: 16        1 -- = 0 + --- 45

Decipher A Seven Segment Display

Description Today's challenge will be to create a program to decipher a seven segment display, commonly seen on many older electronic devices. Input Description For this challenge, you will receive 3 lines of input, with each line being 27 characters long (representing 9 total numbers), with the digits spread across the 3 lines. Your job is to return the represented digits. You don't need to account for odd spacing or missing segments. Output Description Your program should print the numbers contained in the display. Challenge Inputs     _  _     _  _  _  _  _   | _| _||_||_ |_   ||_||_|   ||_  _|  | _||_|  ||_| _|     _  _  _  _  _  _  _  _ |_| _| _||_|| ||_ |_| _||_   | _| _||_||_| _||_||_  _|  _  _  _  _  _  _  _  _  _ |_  _||_ |_| _|  ||_ | ||_|  _||_ |_||_| _|  ||_||_||_|  _  _        _  _  _  _  _ |_||_ |_|  || ||_ |_ |_| _|  _| _|  |  ||_| _| _| _||_ Challenge Outputs 123456789 433805825 526837608 954105592 Solution in Go package mai

Kolakoski Sequence

Description A Kolakoski sequence (A000002) is an infinite sequence of symbols {1, 2} that is its own run-length encoding. It alternates between "runs" of symbols. The sequence begins: 12211212212211211221211212211... The first three symbols of the sequence are 122, which are the output of the first two iterations. After this, on the i-th iteration read the value x[i] of the output (one-indexed). If i is odd, output x[i] copies of the number 1. If i is even, output x[i] copies of the number 2. There is an unproven conjecture that the density of 1s in the sequence is 1/2 (50%). In today's challenge we'll be searching for numerical evidence of this by tallying the ratio of 1s and 2s for some initial N symbols of the sequence. Input Description As input you will receive the number of outputs to generate and tally. Output Description As output, print the ratio of 1s to 2s in the first n symbols. Sample Input 10 100 1000 Sample Output 5:5 49:51 502:498

DNA Sequencing

Description DNA sequences are made up of a 4 character alphabet - A, C, T or G, that describe the nucleotide bases in a gene sequence. To ascertain the sequence of DNA, scientists use chemical methods to identify the component nucleotides in a method called DNA sequencing. DNA shotgun sequencing is a method whereby DNA subsequences of the same larger sequence are produced at massive parallel scale by DNA sequencing methods, and the overlap between segments is used to reconstruct the input gene. This is a fast and accurate method, and is dropping in price. Shotgun sequencing was used to perform the first entire sequence of a human's DNA, for example. For additional background information, see Wikipedia on shotgun sequencing. You're working in a DNA laboratory and you have to reconstruct a gene's sequence from a series of fragments! Formal Input Description You'll be given a series of DNA sequence fragments, which include overlaps with neighbor sequences, but not

Goldbach's Weak Conjecture

Description According to Goldbach’s weak conjecture, every odd number greater than 5 can be expressed as the sum of three prime numbers. (A prime may be used more than once in the same sum.) This conjecture is called "weak" because if Goldbach's strong conjecture (concerning sums of two primes) is proven, it would be true. Computer searches have only reached as far as 1018 for the strong Goldbach conjecture, and not much further than that for the weak Goldbach conjecture. In 2012 and 2013, Peruvian mathematician Harald Helfgott released a pair of papers that were able to unconditionally prove the weak Goldbach conjecture. Your task today is to write a program that applies Goldbach's weak conjecture to numbers and shows which 3 primes, added together, yield the result. Input Description You'll be given a series of numbers, one per line. These are your odd numbers to target. Examples: 11 35 Output Description Your program should emit three prime number

Alphabet Cipher

Description "The Alphabet Cipher", published by Lewis Carroll in 1868, describes a Vigenère cipher (thanks /u/Yadkee for the clarification) for passing secret messages. The cipher involves alphabet substitution using a shared keyword. Using the alphabet cipher to tranmit messages follows this procedure: You must make a substitution chart like this, where each row of the alphabet is rotated by one as each letter goes down the chart. All test cases will utilize this same substitution chart.   ABCDEFGHIJKLMNOPQRSTUVWXYZ A abcdefghijklmnopqrstuvwxyz B bcdefghijklmnopqrstuvwxyza C cdefghijklmnopqrstuvwxyzab D defghijklmnopqrstuvwxyzabc E efghijklmnopqrstuvwxyzabcd F fghijklmnopqrstuvwxyzabcde G ghijklmnopqrstuvwxyzabcdef H hijklmnopqrstuvwxyzabcdefg I ijklmnopqrstuvwxyzabcdefgh J jklmnopqrstuvwxyzabcdefghi K klmnopqrstuvwxyzabcdefghij L lmnopqrstuvwxyzabcdefghijk M mnopqrstuvwxyzabcdefghijkl N nopqrstuvwxyzabcdefghijklm O opqrstuvwxyzabcdefghijklmn P pqrstuvw

Possible Number of Pies

Description It's Thanksgiving eve and you're expecting guests over for dinner tomorrow. Unfortunately, you were browsing memes all day and cannot go outside to buy the ingredients needed to make your famous pies. You find some spare ingredients, and make do with what you have. You know only two pie recipes, and they are as follows: Pumpkin Pie 1 scoop of synthetic pumpkin flavouring (Hey you're a programmer not a cook) 3 eggs 4 cups of milk 3 cups of sugar Apple Pie 1 apple 4 eggs 3 cups of milk 2 cups of sugar Your guests have no preference of one pie over another, and you want to make the maximum number of (any kind) of pies possible with what you have. You cannot bake fractions of a pie, and cannot use fractions of an ingredient (So no 1/2 cup of sugar or anything like that) Input Format You will be given a string of 4 numbers separated by a comma, such as 10,14,10,42,24. Each number is a non-negative integer. The numbers represent the number of syntheti

How to Connect Visual Studio with MySQL Database

Tester Developer and Bug

Making Simple MATH QUIZ Game | NetBeans

Ancient Flash Drive

Learn 1 To 10 From Bill Gates

Integer Complexity 3

Background The integer complexity of a positive integer is the minimum possible sum of the numbers used in an expression - using only positive integers, addition, multiplication, and parentheses - that's equal to the given number. See this week's Intermediate challenge for examples and more information. The typical definition of integer complexity disallows all numbers in the expression other than 1. This definition is equivalent, so either one you want to use is fine. As far as I know, efficiently determining the integer complexity of a given number is an open question. Your challenge is to provide as tight an upper limit as possible for a particular input. Challenge Post an expression equal to 12345678910111213 - using only positive integers, addition, multiplication, and parentheses - such that the sum of the numbers in the expression is as small as possible. Here's one example: 1+4*3*3*3*(1+4*4*(1+3*(1+3*(1+5*3*3*(1+5*4*4*2*(1+4*3*(1+4*4*3*2*(2+5*(1+5*4*3*(

Programmer's Quote

Integer Complexity 2

Background Consider all the different ways of representing a positive integer using nothing but positive integers, addition, multiplication, and parentheses. For 5678, a few such ways are: 5678 = 2*17*167 5678 = 5678 5678 = 23*59+29*149 5678 = (1+4*4)*(1+3*3*(1+3*3*4)) 5678 = 2*(1+2*(1+2*(1+2*2*(1+2*2*2*2*(1+2*(1+2*2)))))) For each such representation, consider the sum of the integers involved: 2*17*167 => 2+17+167 = 186 5678 => 5678 = 5678 23*59+29*149 => 23+59+29+149 = 260 (1+4*4)*(1+3*3*(1+3*3*4)) => 1+4+4+1+3+3+1+3+3+4 = 27 2*(1+2*(1+2*(1+2*2*(1+2*2*2*2*(1+2*(1+2*2)))))) =>     2+1+2+1+2+1+2+2+1+2+2+2+2+1+2+1+2+2 = 30 For 5678, the minimum possible sum for any such representation is 27. The minimum possible sum for a given integer is known as its integer complexity, so the integer complexity of 5678 is 27. The integer complexity of the numbers 1, 2, 3, ... is: 1 2 3 4 5 5 6 6 6 7 8 7 8 8 8 8 9 8 9 9 ... The sum of the integer complexities for all

Pass By Reference and Pass By Value

Data Warehousing Before Computer Age

Integer Complexity 1

Challenge Given a number A, find the smallest possible value of B+C, if B*C = A. Here A, B, and C must all be positive integers. It's okay to use brute force by checking every possible value of B and C. You don't need to handle inputs larger than six digits. Post the return value for A = 345678 along with your solution. For instance, given A = 12345 you should return 838. Here's why. There are four different ways to represent 12345 as the product of two positive integers: 12345 = 1*12345 12345 = 3*4115 12345 = 5*2469 12345 = 15*823 The sum of the two factors in each case is: 1*12345 => 1+12345 = 12346 3*4115 => 3+4155 = 4158 5*2469 => 5+2469 = 2474 15*823 => 15+823 = 838 The smallest sum of a pair of factors in this case is 838. Examples 12 => 7 456 => 43 4567 => 4568 12345 => 838 The corresponding products are 12 = 3*4, 456 = 19*24, 4567 = 1*4567, and 12345 = 15*823. Hint Want to test whether one number divides evenly into

Create a Simple Stochastic Computing

Description Stochastic computing, first introduced by the noted scientist John von Neumann in 1953, is a collection of techniques that represent continuous values (for example probabilities between 0 and 1) using streams of random bits. The bits in the stream represent the probabilities. Complex computations can then be computed over these stream by applying simple bit-wise operations. For example, given two probabilities p and q, using 8 bits, to represent the probabilities 0.5 and 0.25: 10011010 01010000 To calculate p x q we apply the logical AND over the bitstream: 00010000 Yielding 1/8, or 12.5%, the correct value. For an 8-bit stream, this is the smallest unit of precision we can calculate. To increase precision we must increase the size of the bitstream. This approach has a few benefits in a noisy environment, most importantly a tolerance for loss (for example in transmission) and better fidelity over various bit lengths. However, precision comparable to a standard

I Will Find It And Install

The Pancake Sorting Problem

Description I work as a waiter at a local breakfast establishment. The chef at the pancake house is sloppier than I like, and when I deliver the pancakes I want them to be sorted biggest on bottom and smallest on top. Problem is, all I have is a spatula. I can grab substacks of pancakes and flip them over to sort them, but I can't otherwise move them from the middle to the top. How can I achieve this efficiently? This is a well known problem called the pancake sorting problem. Bill Gates once wrote a paper on this that established the best known upper bound for 30 years. This particular challenge is two-fold: implement the algorithm, and challenge one another for efficiency. Input Description You'll be given a pair of lines per input. The first line tells you how many numbers to read in the next line. The second line tells you the pancake sizes as unsigned integers. Read them in order and imagine them describing pancakes of given sizens from the top of the plate to t

Error On Line 144?

Closest String

Description In theoretical computer science, the closest string is an NP-hard computational problem, which tries to find the geometrical center of a set of input strings. To understand the word "center", it is necessary to define a distance between two strings. Usually, this problem is studied with the Hamming distance in mind. This center must be one of the input strings. In bioinformatics, the closest string problem is an intensively studied facet of the problem of finding signals in DNA. In keeping with the bioinformatics utility, we'll use DNA sequences as examples. Consider the following DNA sequences: ATCAATATCAA ATTAAATAACT AATCCTTAAAC CTACTTTCTTT TCCCATCCTTT ACTTCAATATA Using the Hamming distance (the number of different characters between two sequences of the same length), the all-pairs distances of the above 6 sequences puts ATTAAATAACT at the center. Input Description You'll be given input with the first line an integer N telling you how ma

Write A Web Crawler

Description Most of us are familiar with web spiders and crawlers like GoogleBot - they visit a web page, index content there, and then visit outgoing links from that page. Crawlers are an interesting technology with continuing development. Web crawlers marry queuing and HTML parsing and form the basis of search engines etc. Writing a simple crawler is a good exercise in putting a few things together. Writing a well behaved crawler is another step up. For this challenge you may use any single shot web client you wish, e.g. Python's httplib or any of a number of libcurl bindings; you may NOT use a crawling library like Mechanize or whatnot. You may use an HTML parsing library like BeautifulSoup; you may NOT use a headless browser like PhantomJS. The purpose of this challenge is to tie together fetching a page, reassembling links, discovering links and assembling them, adding them to a queue, managing the depth of the queue, and visiting them in some reasonable order - while av

Making a simple SNAKE Game

Making a simple SNAKE Game | Unity