This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public ListNode sortList(ListNode head) { | |
if (head == null || head.next == null) | |
return head; | |
// step 1. cut the list to two halves | |
ListNode prev = null, slow = head, fast = head; | |
while (fast != null && fast.next != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UserName = input("Please enter your name: ") | |
print("Hello " + UserName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample = ['goyun.info', 'nextruby.com', 'sqley.com'] | |
for i in sample: | |
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package info.goyun; | |
public class StringBuilderDemo { | |
public static void main(String[] args) { | |
StringBuilder str = new StringBuilder("Go.info"); | |
System.out.println("string = " + str); | |
// insert character value at offset 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
fmt.Println("hello world") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(final String[] args) { | |
final Scanner scan = new Scanner(System.in); | |
if (!scan.hasNext()) { | |
System.out.print("0"); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Solution { | |
public static String getSmallestAndLargest(String str, int k) { | |
String smallest = ""; | |
String largest = ""; | |
// Complete the function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create NumberFormats using Locales */ | |
NumberFormat us = NumberFormat.getCurrencyInstance(Locale.US); | |
NumberFormat china = NumberFormat.getCurrencyInstance(Locale.CHINA); | |
NumberFormat france = NumberFormat.getCurrencyInstance(Locale.FRANCE); | |
/* Print output */ | |
System.out.println("US: " + us.format(payment)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
@SpringBootApplication | |
public class DemoApplication { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.BitSet; | |
/** | |
* Find missing elements in a Integer array containing numbers | |
*/ | |
public class I88CA { | |
public static void main(String args[]) { |