This file contains hidden or 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 boolean wordPattern(String pattern, String str) { | |
| if (pattern == null || str == null) return false; | |
| String[] words = str.split(" "); | |
| if (pattern.length() != words.length) return false; | |
| HashMap<Character, String> map = new HashMap<Character, String>(); | |
| for (int i = 0; i < pattern.length(); i++){ | |
| char c = pattern.charAt(i); | |
| String s = words[i]; |
This file contains hidden or 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
| class Solution{ | |
| public static void main(String[] args) { | |
| int[] a = {1, 2, 3, 5, 6, 7}; | |
| rotateArray(a, 3); | |
| for (int i = 0; i < a.length; i++){ | |
| System.out.print(a[i]); | |
| } | |
| } | |
| public static void rotateArray(int[] a, int k){ |