From 6f6e0179350529b75459481059b83438d15c70d0 Mon Sep 17 00:00:00 2001 From: Vincent Le Date: Tue, 20 Jun 2017 16:05:23 -0700 Subject: [PATCH] Add facebook interview problem --- java/interview/bipartition-pattern-matching.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 java/interview/bipartition-pattern-matching.java diff --git a/java/interview/bipartition-pattern-matching.java b/java/interview/bipartition-pattern-matching.java new file mode 100644 index 0000000..eff88dc --- /dev/null +++ b/java/interview/bipartition-pattern-matching.java @@ -0,0 +1,14 @@ +/** + * @Company Facebook + * + * Given two strings, str and pattern, return true if the str has a valid mapping between the words in str and the characters in the pattern. + * The str will be whitespace separated and the pattern will be depicted using characters. + * + * Problem Ex. + * Input: 'cat dog dog cat', 'abba' + * Output: true because cat = a and dog = b. + * + * Input: 'cat dog dog foo', 'abba' + * Output: false because cat = a so foo cannot == a + */ +public boolean isValidPattern(String str, String pattern) { }