/* * Worst-case performance : O(kn) * Worst-case space complexity : O(k + N) */