Git Product home page Git Product logo

coding_kata_repeatchop_and_fizzbuzz's Introduction

This mini project tackles two challenges as follows

1) ====== Remove Extra Chars ======

Return a string where the number of consecutive characters of the same value is limited to the parameter supplied
Example: "aaabbcccccdddd".RemoveConsecuitiveChars(2) should return "aabbccdd"

2) ====== Fizz Buzz ======

Should return each number between zero and its parameter but replaces multiples of 3 with 'Fizz' and multiples of 5 with 'Buzz'
Where the number of 'z' characters each word is the same as the other factor of the input number
For multiples of both 3 and 5 replace the number with both of the corresponding 'Fizz'-'Buzz' words. eg 15=\"Fizzzzz-Buzzz\

Solutions

Challenge 'Remove Extra Chars'

In the StringExtension class, RemoveConsecuitiveChars(int) method accepts the number of allowed consecutive characters as int.
The characters in the passed string are put into a HasSet so that the distinct characters in the string can be retrieved. And then use the string
buidling method to build the final string based on the allowed consecutive characters.The implementation has a time complexity of O(N).

Challenge 'Fizz Buzz'

In the FizzBuzzCalculator class the method FizzBuzz(int) is broken into smaller task to achieve completion of this method. Inside the FizzBuzz method an iterator ietrates till the int provided
as argument to the method from 0. For each number in the ietration, the factorial of that number divisible by 3 or and 5 are retrived in the form of Tuples.
This implemntation also has time complexity of O(N). The return value of FizzBuzz(int) is a list of string obejcts and the gcAllowVeryLargeObjects is set to true to enable the CLR to allow large objects
greater than 2GB during the runtime. This method is also executed for FizzBuzz(100000) and the program ran to completion. 

Result Screenshot

Solution Result Fizz Buzz

Solution Result Fizz Buzz

Fizz Buzz solution's memory footprint for Parameter = 100,000 i.e. FizzBuzz(100000)

Solution Result Fizz Buzz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.