Skip to content

Instantly share code, notes, and snippets.

View inv-Ayiba's full-sized avatar
💭
I'm happening

Tari ogounga inv-Ayiba

💭
I'm happening
  • B&D
  • Port Harcourt, Rivers State, Nigeria
View GitHub Profile
package main
func packetDescrambler(seq []int, fragmentData []string, n int) string {
maxSeqIdx := func(numSlice []int) int {
max := numSlice[0]
for _, n := range numSlice[1:] {
if n > max {
max = n
}
}
@KrzysztofCiba
KrzysztofCiba / perm.py
Last active October 11, 2021 09:05
Get nth permutation of a list, while permutations are created in a lexicographical order.
#!/bin/env python
"""
Solves a problem of getting permutation of a given index,
while you know that permutations are created in a lexicographical order.
As input you are specifying a list of elements and index of permutation you want to get.
"""
## imports
from math import factorial
## this one just for checking