Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita95fcbb

Browse files
authored
Improved task 138
1 parentcb76925 commita95fcbb

File tree

2 files changed

+7
-7
lines changed
  • src
    • main/ruby/g0101_0200/s0138_copy_list_with_random_pointer
    • test/ruby/g0101_0200/s0138_copy_list_with_random_pointer

2 files changed

+7
-7
lines changed

‎src/main/ruby/g0101_0200/s0138_copy_list_with_random_pointer/solution.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# @param {Node} node
1818
# @return {Node}
19-
defcopy_random_list(head)
19+
defcopyRandomList(head)
2020
returnnilifhead.nil?
2121

2222
# First pass to create cloned nodes and insert them after the original nodes

‎src/test/ruby/g0101_0200/s0138_copy_list_with_random_pointer/solution_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative'../../../../main/ruby/g0101_0200/s0138_copy_list_with_random_pointer/solution'
44

55
classSolutionTest <Minitest::Test
6-
deftest_copy_random_list
6+
deftest_copyRandomList
77
node7=Node.new(7)
88
node13=Node.new(13)
99
node11=Node.new(11)
@@ -20,21 +20,21 @@ def test_copy_random_list
2020
node10.random=node11
2121
node1.random=node7
2222
expected_result='[[7, nil],[13, 0],[11, 4],[10, 2],[1, 0]]'
23-
assert_equalexpected_result,copy_random_list(node7).to_s
23+
assert_equalexpected_result,copyRandomList(node7).to_s
2424
end
2525

26-
deftest_copy_random_list_2
26+
deftest_copyRandomList_2
2727
node1=Node.new(1)
2828
node2=Node.new(2)
2929
node1.next=node2
3030
node1.random=node1
3131
node2.next=nil
3232
node2.random=node2
3333
expected_result='[[1, 0],[2, 1]]'
34-
assert_equalexpected_result,copy_random_list(node1).to_s
34+
assert_equalexpected_result,copyRandomList(node1).to_s
3535
end
3636

37-
deftest_copy_random_list_3
37+
deftest_copyRandomList_3
3838
node31=Node.new(3)
3939
node32=Node.new(3)
4040
node33=Node.new(3)
@@ -45,6 +45,6 @@ def test_copy_random_list_3
4545
node33.next=nil
4646
node33.random=nil
4747
expected_result='[[3, nil],[3, 0],[3, nil]]'
48-
assert_equalexpected_result,copy_random_list(node31).to_s
48+
assert_equalexpected_result,copyRandomList(node31).to_s
4949
end
5050
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp