Skip to content

Instantly share code, notes, and snippets.

View SophiaPetrova's full-sized avatar

Sophia Petrova SophiaPetrova

  • Berlin, Germany
View GitHub Profile
describe '#common_digits_count' do
it { expect(common_digits_count(567, 678)).to eq(2) }
it { expect(common_digits_count(123444, 3445)).to eq(2) }
it { expect(common_digits_count(456, -2358)).to eq(1) }
it { expect(common_digits_count(111, 111)).to eq(1) }
it { expect(common_digits_count(111, -111)).to eq(1) }
it { expect(common_digits_count(11221, -1121)).to eq(2) }
it { expect(common_digits_count(-11221, -1121)).to eq(2) }
it { expect(common_digits_count(1234, 56)).to eq(0) }
end
describe 'remove_duplicates' do
it 'removes duplicates' do
expect(remove_duplicates [-2, 12, 33, -2, 42, -2, 4, 8, 4, 13, 12]).
to eq [-2, 12, 33, 42, 4, 8, 13]
expect(remove_duplicates [-1, 4, -1, 33, 33, 42, 4]).
to eq [-1, 4, 33, 42]
expect(remove_duplicates [0, 7, 8, 7, 8, 78, 0, 2, 4, 6]).
to eq [0, 7, 8, 78, 2, 4, 6]
end
it 'returns empty array' do