Ruby 怎样使用 Ruby 实现树形结构

yingce · March 16, 2017 · Last by liprais replied at March 16, 2017 · 1656 hits
数组是这样:
list = [["a"], ["a", "b"], ["a", "b", "c"], ["a", "b", "c", "d"]]

需要转换的 Hash 大致这样

{
  "a" => {
    "b" => {
      "c" => {
        "d" => {}
      }
    }
  }
}
yingce closed this topic. 16 Mar 16:42
yingce reopened this topic. 16 Mar 16:42
yingce closed this topic. 16 Mar 16:42
You need to Sign in before reply, if you don't have an account, please Sign up first.