Skip to content

feat: LeetCode 1929 only - by Dwight Blue #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

cdbluejr
Copy link
Contributor

No description provided.


/**
* Provide the solution to LeetCode 2942 here:
* https://leetcode.com/problems/find-words-containing-character/
*/
public List<Integer> findWordsContaining(String[] words, char x) {
return null;
var words = new ArrayList<Integer>();
int wordArray = (words.length)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a semicolon on this line, but I don't think you need this anyway.


// int[] newArray = new int[words.length + 1];

for (int i=0; i<originalArray; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably want i < words.length

for (int i=0; i<originalArray; i++) {
if (words[i].contains(Character.toString(x)));
// System.arraycopy(words,i,newArray,i,words.length);
ArrayList.add(i);
Copy link
Contributor

Choose a reason for hiding this comment

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

ArrayList is a class, you want to make a new ArrayList instance and then call add on that object.

var results = new ArrayList<Integer>();
results.add(5);

for (int i=0; i<n; i++) {
ans[i]=nums[i];
ans[i+n]=nums[i];
} return ans;
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to run ./gradlew spotlessApply to fix the formatting issues in this file.

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