Skip to content

Commit ff02d75

Browse files
authored
Merge pull request #726 from fartem/lcsc
2024-08-30 v. 6.5.9.1: added LCSC support
2 parents 1391cde + 14d854d commit ff02d75

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lcsp/counter.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
require 'find'
4+
5+
module LCSC
6+
# Solutions counter.
7+
class LCSCCounter
8+
# @param {String} path
9+
def initialize
10+
@path = './'
11+
end
12+
13+
# @return {Integer}
14+
def count
15+
dir_sub = "#{@path}/lib"
16+
17+
easy = find_for_dir("#{dir_sub}/easy")
18+
medium = find_for_dir("#{dir_sub}/medium")
19+
20+
easy + medium
21+
end
22+
23+
private
24+
25+
def find_for_dir(dir)
26+
::Find.find(dir).count { |file| ::File.file?(file) }
27+
end
28+
end
29+
end

leetcode-ruby.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require 'English'
55
::Gem::Specification.new do |s|
66
s.required_ruby_version = '>= 3.0'
77
s.name = 'leetcode-ruby'
8-
s.version = '6.5.9'
8+
s.version = '6.5.9.1'
99
s.license = 'MIT'
1010
s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
1111
s.executable = 'leetcode-ruby'

0 commit comments

Comments
 (0)