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 boolean searchMatrix(int[][] matrix, int target) { | |
if (matrix.length == 0) { | |
return false; | |
} | |
if (matrix[0].length == 0) { | |
return false; | |
} |
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 int largestRectangleArea(int[] heights) { | |
Stack<Integer> s = new Stack<>(); | |
int result = 0; | |
for (int i = 0; i <= heights.length; ) { | |
final int value = i < heights.length ? heights[i] : 0; | |
if (s.isEmpty() || value > heights[s.peek()]) { | |
s.push(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 boolean wordBreak(String s, List<String> wordDict) { | |
boolean[] mem = new boolean[s.length() + 1]; | |
mem[0] = true; | |
for (int i = 1; i <= s.length(); i++) { | |
for (int k = 0; k < i; k++) { | |
if (mem[k] && wordDict.contains(s.substring(k, i))) { | |
mem[i] = true; | |
break; |
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
#define FOUND 1 | |
#define NOT_FOUND 0 | |
int search(int x[], int y[], int z[], int X, int Y, int Z, | |
int *XX, int *YY, int *ZZ) { | |
*XX = *YY = *ZZ = 0; | |
while (*XX < X && *YY < Y && *ZZ < Z) | |
if (x[*XX] < y[*YY]) { | |
(*XX)++; | |
} else if (y[*YY] < z[*ZZ]) { |
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
int index_search(int x[], int n) { | |
int first = 0; | |
int last = n - 1; | |
int middle, index; | |
index = -1; | |
while (first <= last) { /* a modified binary search*/ | |
middle = (first + last) / 2; | |
if (x[middle] == middle) { | |
index = middle; |
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 CountingSort { | |
static int[] countingSort(int arr[]) { | |
int[] aux = new int[arr.length]; | |
int min = arr[0]; | |
int max = arr[0]; | |
for (int i = 1; i < arr.length; i++) { | |
if (arr[i] < min) { | |
min = arr[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
#0 gfx::GLApiBase::glViewportFn (this=0x182605816b60, x=0, y=0, width=248, height=1078) at ../../ui/gl/gl_bindings_autogen_gl.cc:8006 | |
#1 gpu::gles2::GLES2DecoderImpl::DoViewport (this=0x198a38b57c20, x=0, y=0, width=248, height=1078) at ../../gpu/command_buffer/service/gles2_cmd_decoder.cc:8259 | |
#2 0x00007fffe9c78ee4 in gpu::gles2::GLES2DecoderImpl::HandleViewport (this=0x198a38b57c20, immediate_data_size=0, cmd_data=0x7fffd2cf6a88) at ../../gpu/command_buffer/service/gles2_cmd_decoder_autogen.h:3996 | |
#3 0x00007fffe9c84928 in gpu::gles2::GLES2DecoderImpl::DoCommandsImpl<false> (this=0x198a38b57c20, num_commands=20, buffer=0x7fffd2cf6a4c, num_entries=81, entries_processed=0x7fffffffb624) at ../../gpu/command_buffer/service/gles2_cmd_decoder.cc:4378 | |
#4 0x00007fffe9c439bb in gpu::gles2::GLES2DecoderImpl::DoCommands (this=0x198a38b57c20, num_commands=20, buffer=0x7fffd2cf6a4c, num_entries=81, entries_processed=0x7fffffffb624) at ../../gpu/command_buffer/service/gles2_cmd_decoder.cc:4436 | |
#5 0x00007fffe9bfa64f |