-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
b5f360d
to
fa9ad5e
Compare
|
||
/** | ||
* 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) |
There was a problem hiding this comment.
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++) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
No description provided.