## [f]izzbuzzer

### Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

# Archive for November 2016

### Ema’s Supercomputer challenge

Problem statement Ema built a quantum computer! Help her test its capabilities by solving the problem below. Given a grid of size , each cell in the grid is either or . A valid plus is defined here as the crossing of two segments (horizontal and vertical) of equal lengths. . . . Read more

### Abbreviation challenge

Problem statement You can perform the following operation on some string, : 1. Capitalize zero or more of ‘s lowercase letters at some index i (i.e., make them uppercase). 2. Delete all of the remaining lowercase letters in . Given queries in the form of two strings, and , determine . . . Read more

### Goodland Electricity challenge – O(n)

In the previous post I discussed an algorithm that had a running time of . Well here is an algorithm to the Goodland Electricity challenge. Greedy algorithm For each city i store its preceding tower in previousTowerFor[i]. If i has a tower then previousTowerFor[i] = i. If no tower precedes, . . . Read more

### Reverse words in string

Problem statement Given an input string, reverse the string word by word. For example, given s = “the sky is blue”, return “blue is sky the”. Solution algorithm Write a function reverse(string, start, end) that reverses string[start:end]. Reverse entire input string. Iterate over (reversed)words in reversed string and correct them . . . Read more

### Goodland Electricity challenge

Problem statement Goodland is a country with cities, and each city is sequentially numbered from to . These cities are connected by roads, and each road connects city to its neighboring city, . The distance between any two cities and is . Goodland’s government started a project to improve the . . . Read more

### Gridland Metro challenge

Problem statement The city of Gridland is represented as an matrix where the rows are numbered from to and the columns are numbered from to . Gridland has a network of train tracks that always run in straight horizontal lines along a row. In other words, the start and end . . . Read more

### Generating CSV reports from SQL*Plus

Problem statement Suppose you have a query whose result needs to be exported as a CSV file. In addition some fields need to be parsed into a different format and columns need to be renamed. The SPOOL command The SPOOL command causes SQL*Plus to write the results to a file. . . . Read more

### Compare tables in different databases using a pre-defined mapping – Java, JDBC, Hibernate

Full code https://github.com/lucaslouca/database-comparison

### Compare Excel sheets in Java

Full code https://github.com/lucaslouca/compare-sheets

### A simple maze generation algorithm

Knowing how to create a maze is as essential as breathing. So here is a simple algorithm to create mazes along with a link to a GitHub repository for its implementation in Swift. Algorithm 1. Start at cell (1, 1). 2. Find a neighbor at random that you haven’t yet . . . Read more