Add new test to find first unique Character
This commit is contained in:
parent
3404acc543
commit
6baa2c473f
@ -0,0 +1,59 @@
|
|||||||
|
package com.ossez.toolkits.codebank.tests.leetcode;
|
||||||
|
|
||||||
|
import com.ossez.toolkits.codebank.common.model.TreeNode;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 7
|
||||||
|
* <ul>
|
||||||
|
* <li>@see <a href=
|
||||||
|
* "https://www.cwiki.us/display/ITCLASSIFICATION/Serialize+and+Deserialize+Binary+Tree">https://www.cwiki.us/display/ITCLASSIFICATION/Serialize+and+Deserialize+Binary+Tree</a>
|
||||||
|
* <li>@see<a href=
|
||||||
|
* "https://leetcode.com/problems/first-unique-character-in-a-string/">https://leetcode.com/problems/first-unique-character-in-a-string/</a>
|
||||||
|
* </ul>
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author YuCheng
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class LeetCode0387FirstUniqueCharacterTest {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(LeetCode0387FirstUniqueCharacterTest.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMain() {
|
||||||
|
logger.debug("BEGIN");
|
||||||
|
String data = "leetcode";
|
||||||
|
|
||||||
|
System.out.println(firstUniqChar(data));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize from array to tree
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int firstUniqChar(String data) {
|
||||||
|
// NULL CHECK
|
||||||
|
if (data.equals("")) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
</Console>
|
</Console>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
<Loggers>
|
<Loggers>
|
||||||
<Logger name="com.insight.sco" level="trace">
|
<Logger name="com.ossez" level="trace">
|
||||||
<AppenderRef ref="Console"/>
|
<AppenderRef ref="Console"/>
|
||||||
</Logger>
|
</Logger>
|
||||||
<Root level="error">
|
<Root level="error">
|
Loading…
x
Reference in New Issue
Block a user