Skip to content

Conversation

@ThanhNIT
Copy link
Contributor

No description provided.

class SolutionTest {
@Test
void test() {
assertThat(new Solution().decode(""), equalTo(""));
Copy link
Owner

@javadev javadev Aug 16, 2023

Choose a reason for hiding this comment

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

Please add tests

internal class SolutionTest { @Test fun minFlips() { assertThat(Solution().minFlips("10111"), equalTo(3)) } @Test fun minFlips2() { assertThat(Solution().minFlips("101"), equalTo(3)) } @Test fun minFlips3() { assertThat(Solution().minFlips("00000"), equalTo(0)) } }
// #Medium #String #Greedy

public class Solution {
public String decode(String value) {
Copy link
Owner

@javadev javadev Aug 16, 2023

Choose a reason for hiding this comment

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

Please add solution

class Solution { fun minFlips(target: String): Int { var flipCount = target[0].code - 48 var prev = target[0] for (ch in target.toCharArray()) { if (ch != prev) { flipCount++ prev = ch } } return flipCount } }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solutions 1478 and 1529 are already existed

@javadev javadev changed the title Added tasks 1327, 1341, 1478, 1517, 1633 Added tasks 1327, 1341, 1478, 1517, 1529, 1633 Aug 16, 2023
@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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@javadev javadev changed the title Added tasks 1327, 1341, 1478, 1517, 1529, 1633 Added tasks 1327, 1341, 1478, 1517, 1633 Aug 16, 2023
@javadev
Copy link
Owner

javadev commented Aug 16, 2023

@javadev javadev merged commit 4806998 into javadev:main Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants