It is a sorting algorithm generation. We have a list containing 25 numbers, that we need to sort and figure out the greatest three numbers. However, the catch is that you can only sort 5 numbers in a single operation. So, basically imagine a function that will sort your numbers but can only take in 5 at a time. Using this function we need to be able to sort the 25 numbers to get top 3. Also, make a note of how many times the sorting function is called.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"os" | |
"strconv" | |
) | |
var csvData = [][]string{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Document> | |
<!-- | |
Additional Styles have been added for 1,2,3,4, and 5 Bed houses | |
--> | |
<Style id="1"> | |
<IconStyle> | |
<Icon> | |
<href>http://maps.google.com/mapfiles/kml/paddle/1.png</href> | |
</Icon> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def duplicate_index(array) | |
size = array.size | |
duplicate = [] | |
duplicate_indexes = [] | |
array.uniq.each do |a| | |
duplicate_index = [] | |
size.times do |i| | |
duplicate_index << i if array[i] == a | |
end | |
duplicate << duplicate_index if duplicate_index.size > 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
file_naming_count = 0 | |
row_count = 0 | |
# basic file and directory naming | |
parent_csv_filename = "/folder/filename.csv" | |
csv_output_directory = "/folder/splitted/" | |
f=File.open(parent_csv_filename) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSV.open("bad_sliced_sheets_22july.csv", "w") do |csv| | |
csv << ['Sheet Id', 'Sheet url'] | |
Sheet.bad_sliced.each do |sheet| | |
csv << [sheet.id, sheet.image_url] | |
print '.' | |
end | |
end |