All Projects → jindulys → Hackerranksolutions

jindulys / Hackerranksolutions

Licence: mit
This is a repo for HackerRankSolutions with Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Hackerranksolutions

Competitive Programming
VastoLorde95's solutions to 2000+ competitive programming problems from various online judges
Stars: ✭ 147 (-30.99%)
Mutual labels:  algorithm, datastructures, hackerrank
Algorithms And Data Structures In Java
Algorithms and Data Structures in Java
Stars: ✭ 498 (+133.8%)
Mutual labels:  algorithm, datastructures, hackerrank
Competitive Programming
📌 📚 Solution of competitive programming problems, code templates, Data Structures and Algorithms, hackathons, interviews and much more.
Stars: ✭ 496 (+132.86%)
Mutual labels:  algorithm, datastructures, hackerrank
Data Structure And Algorithms
A complete and efficient guide for Data Structure and Algorithms.
Stars: ✭ 48 (-77.46%)
Mutual labels:  algorithm, datastructures, hackerrank
Awesome Java Leetcode
👑 LeetCode of algorithms with java solution(updating).
Stars: ✭ 8,297 (+3795.31%)
Mutual labels:  algorithm, datastructures
Math Advanced Data Structures And Algorithms
Math, Advanced Data Structures & Algorithms - Please check before use
Stars: ✭ 40 (-81.22%)
Mutual labels:  algorithm, datastructures
Data Structures And Algorithms
Data Structures and Algorithms implementation in Go
Stars: ✭ 2,272 (+966.67%)
Mutual labels:  algorithm, datastructures
Algosolutions
LeetCode, LintCode, Project Euler, SGU, HackerRank, Cracking the Coding Interview(ctci)🌴
Stars: ✭ 117 (-45.07%)
Mutual labels:  algorithm, hackerrank
Repository
个人学习知识库涉及到数据仓库建模、实时计算、大数据、Java、算法等。
Stars: ✭ 92 (-56.81%)
Mutual labels:  algorithm, datastructures
Hackerrank
📗 Solutions of more than 380 problems of Hackerrank accross several domains.
Stars: ✭ 128 (-39.91%)
Mutual labels:  algorithm, hackerrank
Python data structures and algorithms
Python 中文数据结构和算法教程
Stars: ✭ 2,194 (+930.05%)
Mutual labels:  algorithm, datastructures
Algorithm
The repository algorithms implemented on the Go
Stars: ✭ 163 (-23.47%)
Mutual labels:  algorithm, datastructures
Phpalgorithms
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
Stars: ✭ 865 (+306.1%)
Mutual labels:  algorithm, datastructures
Competitivequestion
Question solved on various competitive sites 🤘
Stars: ✭ 5 (-97.65%)
Mutual labels:  algorithm, hackerrank
Treelib
An efficient implementation of tree data structure in python 2/3.
Stars: ✭ 540 (+153.52%)
Mutual labels:  algorithm, datastructures
Ngenerics
Data structures and algorithms for .NET
Stars: ✭ 115 (-46.01%)
Mutual labels:  algorithm, datastructures
Algorithms And Data Structures In Ruby
Ruby implementation of Algorithms,Data-structures and programming challenges
Stars: ✭ 489 (+129.58%)
Mutual labels:  algorithm, hackerrank
Cosmos
Hacktoberfest 2021 | World's largest Contributor driven code dataset | Algorithms that run our universe | Your personal library of every algorithm and data structure code that you will ever encounter |
Stars: ✭ 12,936 (+5973.24%)
Mutual labels:  algorithm, datastructures
.codebits
📚 List of resources for Algorithms and Data Structures in Python & other CS topics @2017
Stars: ✭ 144 (-32.39%)
Mutual labels:  algorithm, hackerrank
Matlab Octave
This repository contains algorithms written in MATLAB/Octave. Developing algorithms in the MATLAB environment empowers you to explore and refine ideas, and enables you test and verify your algorithm.
Stars: ✭ 180 (-15.49%)
Mutual labels:  algorithm, datastructures

HackerRankSolutions

HackerRankSolutions

Language Build Status Codewake

This is a repo for HackerRank Solutions in Swift

Different folders are named after corresponding domain names or contest names.

Algorithms

Problem Time Space Difficulty Tag Note Score Max Score
Angry Professor O(n) Easy Implementation 20.0 20.0
SherlockAndTheBeast O(n) Easy Implementation 30.0 30.0
Utopian Tree O(n) Easy Implementation 20.0 20.0
Find Digits O(n) Easy Implementation 25.0 25.0
Funny String O(n) Easy String 25.0 25.0
Pangrams O(n) O(1) Easy String 20.0 20.0
Alternating Characters O(n) O(1) Easy String 20.0 20.0
Game of Thrones O(n) O(1) Easy String 30.0 30.0
Make it anagram O(n) O(1) Easy String 30.0 30.0
Anagram O(n) O(1) Easy String 14.29 25
Two Strings O(n) O(1) Moderate String Set 20.0 25.0
SherlockAndAnagrams O(n^3lgn) O(n^2) Moderate String Sort, Dictionary, Permutation 4.55 50.0
Palindrome Index O(n) O(1) Easy String 25.0 25.0
Sherlock And Valid String O(n) O(1) Difficult String Dictionary 100.0 100.0
Common Child O(n^2) O(n^2) Difficult String Dynamic Programming 50.0 60.0
The Maximum Subarray O(n) O(n) Easy Dynamic Programming 16.67 50.0
The Coin Change Problem O(MN) O(MN) Medium Dynamic Programming bottom-up table construction 60.0 60.0
Red John is Back O(N) + O(nlgn) O(N) Moderate Dynamic Programming memoization 54.17 65
Knapsack O(MN) O(MN) Moderate Dynamic Programming memoization in swift 54.06 60.0
Sam and SubStrings O(N) O(N) Moderate Dynamic Programming 40.0 40.0
The Longest Increasing Subsequence O(N^2) O(N) Advanced Dynamic Programming time out 26.67 60.0
Hexagonal Gird O(N^2) O(N) Moderate Dynamic Programming recursive solution 70.0 70.0
Sherlock and Cost O(N) O(N) Moderate Dynamic Programming 28.13 50.0
Dorsey Thief O(NM) O(NM) Advanced Dynamic Programming 52.76 85.0
Travel Around the World O(N) O(N) Moderate Dynamic Programming validation pass and candidates finding pass 120.0 120.0
Sherlock and Array O(N) O(N) Easy Search 40.0 40.0
Ice Cream Parlor O(N) O(N) Easy Search 30.0 30.0
Maximise Sum O(N) O(NlgN) Moderate Search 20.31 65.0
Missing Number O(N) O(N) Moderate Search Do you believe 0.59s overtime? 25.99 45

Contests

Data Structures in HackerRankHelper

  • FIFO Queue with Two Arraies
  • FIFO Queue with Listnode
  • ListNode
  • AVLNode
  • AVLTree
  • BinaryIndexedTree
  • Heap

Usage

I created class for each problem. If you want to test those solution on HackerRank, please follow this guideline.

  1. create a constant with class name.
let mySolution = MyClass()
  1. call solution method on that constant
mySolution.solution()
  1. copy and paste related helper methods from HackerRankHelper folder, eg. getLine(), getInt()

Swift Package Manager

If you want to use this module to play with local test files, you might need to import this module. Swift Package Manager is a good tool.

Firstly, add following Package.swift to your root directory.

import PackageDescription

let package = Package(
    name:"YourModuleName",
    dependencies: [
        .Package(url:"https://github.com/jindulys/HackerRankSolutions.git", majorVersion:1),
    ]
)

Secondly, when you use this module in your source file, you should:

import HRSwift

Then run swift build, and .build/debug/YourModuleName, Alright, Run!!

Contribution Guidelines

HackerRank lover, swift lover do not hesitate. There are tons of unsolved questions. If you want to contribute a little bit, please write your own swift solutions then make a pull request.

For each question, you should write your own Class in corresponding file, inside that Class define a solution method, which is used for Hackerrank submission. This module could be imported by other packages, so make your class and those usable methods public. If you want to submit solution of Algorithms --> Strings --> Gemstones, you should write your solution inside String.swift. If there is no related file for a subdomain, please create a new file.

Write a test case in HRSwiftTests.swift. You could use sample input and sample output from that question as a test.

 func testAnagram() {
     let test = Anagram()
     XCTAssert(test.solve("aaabbb") == 3, "Pass")
     XCTAssert(test.solve("ab") == 1, "Pass")
     XCTAssert(test.solve("abc") == -1, "Pass")
 }

If you write some general code that could be used afterwards, please write them in HackerRankHelper

Make sure your solution get a reasonable score on HackerRank then pull request.

You should obey Raywenderlich Swift Style Guide

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].