JS
Size: a a a
JS
AP
> unconsRight [] = Nothing; unconsRight [x] = Just (x, []); unconsRight (x:xs) = fmap (x:) <$> unconsRight xs
> unconsRight "Hello!"
Just ('!',"Hello")
я сделяль[
[
palindrom :: String -> Bool
palindrom (firstCh:s@(_:_)) | firstCh == lastCh = palindrom body
where
(body, lastCh) = go [] s
go l [x] = (l, x)
go l (x:xs) = go (x:l) xs
palindrom [_] = True
palindrom [ ] = True
palindrom _ = False
[
AP
MK
[
[
MK
[
[
[
n + (n-2) + (n - 4) + (n - 6) + ...
операций, а наивное n * 2