memahesh / HashCode2020

My Submission for Google HashCode 2020

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HashCode2020

Google HashCode 2020

My Online Qualification Round Submission for Google HashCode 2020

Files, Folders & Description

  • datasets/ - Contains test cases
  • output_*.txt - Generated Output Files
  • HashCode2020_ProblemStatement.pdf - Problem Statement of HashCode 2020
  • Library.java - Library Class containing all details of Library
    • Getters and Setters for Library data as required
  • ScanningFacility.java - Blue Print of how Scanning Facility is designed
  • addLibrary(Library, current_day) - Function for signing up library to the scanning facility
  • scanStrategy(allLibraries) - Contains the scanning strategy for the scanning facility
  • makeSubmission() - Contains the code to write to output_*.txt files
  • bookScores - Variable containing mapping of scores against books
  • signedUpLibraries - Variable containing the list of signedUpLibraries
  • booksScanned - Contains the books scanned by libraries till now
  • lib2BookIDs - Contains a mapping of books scanned against library
  • bookScoreComparator - Comparator that sorts the books by scores currently in booksScores
  • signUpLibraryComparator - Comparator to sort and identify which library to sign up
  • Main.java - The main class file
    • bookScores - Global Variable contains mapping of scores against books
    • books, libraries, maxDays - Distinct Books, Libraries and Total Days given in input
    • readAndExecute(filePath) - Reads from input file and write result to file

Flow

  • Step 1 : Add input data to variables
  • Step 2 : Identify Library to signup at the Scanning Facility using signUpLibraryComparator
  • Step 3 : Identify which Books to scan in the Library selected in Step 2 using bookScoreComparator
  • Step 4 : Remove books that are already scanned from Step 3 using booksScanned
  • Step 5 : Add newly scanned books to booksScanned and removing this library from the set of libraries
  • Step 6 : Update the results of Step 2 and Step 3 to lib2BookIDs
  • Step 7 : Write Output to output_*.txt

Standing

  • Online Round Standing - 9295th Rank
  • Extended Round Standing - 2834th Rank

Todos

  • Fill README.md
  • Comment the code

About

My Submission for Google HashCode 2020


Languages

Language:Java 100.0%