Skip to content

Added tasks 1331, 1332, 1333, 1334, 1335 #568

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

Merged
merged 6 commits into from
Mar 19, 2022

Conversation

ThanhNIT
Copy link
Contributor

No description provided.

for (Integer x : tmp) {
if (!mp.containsKey(x)) mp.put(x, i++);
mp.computeIfAbsent(x, k -> mp.put(k, i[0]++));
Copy link
Owner

Choose a reason for hiding this comment

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

It may be putIfAbsent method.

HashMap<Integer, Integer> mp = new HashMap<Integer, Integer>();
int i = 1;
HashMap<Integer, Integer> mp = new HashMap<>();
final int[] i = {1};
for (Integer x : tmp) {
Copy link
Owner

Choose a reason for hiding this comment

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

It may be just variable i and putIfAbsent method.

@javadev
Copy link
Owner

javadev commented Mar 19, 2022

SolutionTest > arrayRankTransform3() FAILED
java.lang.AssertionError at SolutionTest.java:25

@ThanhNIT
Copy link
Contributor Author

SolutionTest > arrayRankTransform3() FAILED java.lang.AssertionError at SolutionTest.java:25

It fail with putIfAbsent

@ThanhNIT
Copy link
Contributor Author

SolutionTest > arrayRankTransform3() FAILED java.lang.AssertionError at SolutionTest.java:25

It fail with putIfAbsent

@ThanhNIT ThanhNIT closed this Mar 19, 2022
@ThanhNIT ThanhNIT reopened this Mar 19, 2022
@javadev
Copy link
Owner

javadev commented Mar 19, 2022

SolutionTest > arrayRankTransform3() FAILED java.lang.AssertionError at SolutionTest.java:25

It fail with putIfAbsent

Ok, let's revert changes and add suppresswarning.

@javadev
Copy link
Owner

javadev commented Mar 19, 2022

@javadev javadev merged commit d5ed891 into javadev:main Mar 19, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

98.0% 98.0% Coverage
0.0% 0.0% Duplication

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