Reverse a doubly linked list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rust:1.31 | |
WORKDIR /usr/src/myapp |
Inserting a Node Into a Sorted Doubly Linked List
hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list/problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start writing your ScalaFiddle code here | |
def bubble_sort[T <% Ordered[T]](src: List[T]): List[T] = { | |
def my_bs[T <% Ordered[T]](src: List[T], res: List[T], is_swapped: Boolean): List[T] = { | |
src match { | |
case Nil => res | |
case s::Nil => is_swapped match { | |
case true => my_bs(res:+s, List.empty, false) | |
case false => res:+s | |
} | |
case x::xs => x.compareTo(xs.head) match { |
An Optimistic Perspective on Offline Reinforcement Learning
https://ai.googleblog.com/2020/04/an-optimistic-perspective-on-offline.html
- This is still work in progress, follow this Gist if you are interested in the topic
NewerOlder