Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 884 Bytes

practice_questions.md

File metadata and controls

38 lines (24 loc) · 884 Bytes

Problem1

This problem was asked by PayPal.

Given a string and a number of lines k, print the string in zigzag form. In zigzag, characters are printed out diagonally from top left to bottom right until reaching the kth line, then back up to top right, and so on.

For example, given the sentence "thisisazigzag" and k = 4, you should print:

t     a     g
 h   s z   a
  i i   i z
   s     g

Problem2

This problem was asked by Salesforce.

Given an array of integers, find the maximum XOR of any two elements.

Problem3

This problem was asked by Etsy.

Given an array of numbers N and an integer k, your task is to split N into k partitions 
such that the maximum sum of any partition is minimized. Return this sum.

For example, given N = [5, 1, 2, 7, 3, 4] and k = 3, you should return 8, 

since the optimal partition is 
[5, 1, 2], [7], [3, 4].