Skip to content

Instantly share code, notes, and snippets.

@voter101
Forked from rui-localyze/codechallenge2.md
Created September 28, 2021 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voter101/cc5a1a54f07bdc626a62a666b8fb9b78 to your computer and use it in GitHub Desktop.
Save voter101/cc5a1a54f07bdc626a62a666b8fb9b78 to your computer and use it in GitHub Desktop.
Code Challenge v2.0

Localyze

Coding challenge

This is our coding challenge, aimed at getting to know you and your code skills a bit better. There's no time limit on the challenge, but we expect you to invest just a couple of hours of your day. Most of all, we hope you have fun working on this, show off your skills!

What is expected of you?

Choose at least one of the following challenges and using Ruby or Javascript send us the solution to the challenge, ideally hosted on Github or Gitlab.

There is no requirement in using a specific framework or tooling, so it’s up to you to use whatever you find yourself comfortable with. Tests are welcome too.

Please remember to add some documentation explaining how to use your solution.

Challenge 1

Given a word, write an algorithm that returns the sequence of a specific character that appears the most in sequence. If there are many of them, return the first character.

Examples

Given the input "Pressuuuuuure" the output is "uuuuuu"

Given the input "Boat" the output is "B"

Given the input "A hot  dog" the output is "  " (2 spaces!)

Challenge 2

Given a set of numbers, find the subset in which the sum of the elements is the maximum sum.

Example

Given the set of elements [2, -4, 6, 8, -10, 100, -6, 5]

The maximum sum subset is: [2, -4,6, 8, -10, 100, -6, 5]

Thus, the program must return the position of the first and last element of the subset. In this example, the positions 2 and 5, considering the first position with index 0.

Challenge 3

Given two arrays of integers (lengths n and m), find the symmetric difference between them.

Exemple 1

Given the set [1, 2, 3] and the set [3, 4] the output would be [1, 2, 4]

Constraints

  • n, m <= 100

Challenge 4

Given a string s, you need to reverse the order of the words.

Exemple 1

Given the string s = 'Hello World'

The output would be s= 'World Hello'

Example 2

Given the string s = 'I love to code very much'

The output would be s= 'much very code to love I'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment