Skip to content

Add solution for Challenge 4 by hvijaycse#1454

Merged
RezaSi merged 2 commits intoRezaSi:mainfrom
hvijaycse:challenge-4-hvijaycse
Mar 16, 2026
Merged

Add solution for Challenge 4 by hvijaycse#1454
RezaSi merged 2 commits intoRezaSi:mainfrom
hvijaycse:challenge-4-hvijaycse

Conversation

@hvijaycse
Copy link
Contributor

Challenge 4 Solution

Submitted by: @hvijaycse
Challenge: Challenge 4

Description

This PR contains my solution for Challenge 4.

Changes

  • Added solution file to challenge-4/submissions/hvijaycse/solution-template.go

Testing

  • Solution passes all test cases
  • Code follows Go best practices

Thank you for reviewing my submission! 🚀

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba24e4 and 41c57a1.

📒 Files selected for processing (1)
  • challenge-4/submissions/hvijaycse/solution-template.go

Walkthrough

Adds a Go concurrent BFS query processor: a Result type, a standard bfs() helper, a worker() that processes BFS jobs, and ConcurrentBFSQueries() which runs a worker pool, distributes jobs via channels, collects results, and returns a map from start node to BFS visitation order.

Changes

Cohort / File(s) Summary
Concurrent BFS Implementation
challenge-4/submissions/hvijaycse/solution-template.go
Adds Result type, bfs(graph, start), worker(...) goroutine, and ConcurrentBFSQueries(graph, queries, numWorkers) to run a fixed-size worker pool, dispatch BFS jobs over a channel, collect Results, and build map[start] → visitation order. Also includes main placeholder for testing.

Sequence Diagram

sequenceDiagram
    participant Main as ConcurrentBFSQueries
    participant JobChan as Job Channel
    participant Worker as Worker Goroutines
    participant ResultChan as Result Channel
    participant Graph as Graph

    Main->>JobChan: start numWorkers workers
    Main->>JobChan: dispatch query start nodes
    par Workers
        Worker->>JobChan: receive start node
        Worker->>Graph: call bfs(start)
        Worker->>ResultChan: send Result{start, order}
    end
    Main->>ResultChan: collect Results
    Main->>Main: aggregate into map[start] -> order
    Main-->>Main: return result map
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hop through graphs with tiny feet,

workers hum and channels meet,
queues of starts I gladly send,
results come back, maps to mend,
a rabbit cheers: concurrent and fleet! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a Challenge 4 solution submission for user hvijaycse, which matches the changeset content.
Description check ✅ Passed The description is related to the changeset, clearly explaining the Challenge 4 solution submission and file additions, though it provides minimal technical detail.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7ac764 and 7ba24e4.

📒 Files selected for processing (1)
  • challenge-4/submissions/hvijaycse/solution-template.go

@RezaSi RezaSi merged commit 9eb2a7c into RezaSi:main Mar 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants