Skip to content

This repository holds both the challenge and solution that was presented by Payvision company during the recruiting process. It mainly involves an algorithmic solution with focus on performance and refactoring a complex dirty class while applying best practices, patterns, OOP/OOD, SOLID, Clean Code, etc.

mteknight/payvision-recruitment-challenges

 
 

Repository files navigation

See the original source code for these challenges here

SOLUTIONS

Jump to solution information right away from here:

  1. Counting Bits
  2. Refactoring

1- Counting bits

Given an integer, n, we want to know the following:

  1. How many 1-bits are in its binary representation?
  2. Let's say n's binary representation has k significant bits indexed from 1 to k. What are the respective positions (i.e., in ascending order) of each 1-bit?
  3. The performance is really important in this challenge.

Example

Complete Count function in PositiveBitCounter class. It has one parameter: an integer, n. It must return an integer enumerable with the following 1 + k values:

  • The first index (0) must contain the total number of 1 bits in n's binary representation.
  • The subsequent indices must contain the respective positions of the one-indexed 1-bits in n's binary representation.

Output format

Return an enumerable of integers where the first element is the total number of 1-bits in n's binary representation and the subsequent elements are the respective one-indexed locations of each 1-bit from most to least significant.

Tips

The integer n = 161 converts to binary.

1 0 1 0 0 0 0 1

Reverse the binary representation.

1 0 0 0 0 1 0 1

Count number of positive bits: 3

Search the position: 0, 5, 7

Return { 3, 0, 5, 7 }

2- Refactoring fraud detection

Refactor the FraudRadar class. You can make any changes you see that are needed in code or tests. See the tests for more information.

Code Requirements:

  • All the tests must pass.
  • The code should fulfil OOP and SOLID principles.
  • The code should be maintainable.
  • The code should be extensible.
  • You should apply defensive programming practices.
  • Receive the file path is not nice. Think and change the signature and make it cooler.

About

This repository holds both the challenge and solution that was presented by Payvision company during the recruiting process. It mainly involves an algorithmic solution with focus on performance and refactoring a complex dirty class while applying best practices, patterns, OOP/OOD, SOLID, Clean Code, etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%