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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func handler(writer http.ResponseWriter, request *http.Request) { | |
fmt.Fprintf(writer, "Hello Go World, %s!", request.URL.Path[1:]) | |
} |
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
struct Compare | |
{ | |
bool operator() (ListNode* a, ListNode* b){ | |
return a->val > b->val; | |
} | |
}; | |
class Solution{ | |
public: | |
ListNode* mergeKLists( vector<ListNode*>& lists){ |
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 maxArea(verctor<int>& height){ | |
int max = 0; | |
int left = 0, right = height.size()-1; | |
while(left < right){ | |
max = std::max( max, std::min(height[left], height[right]) * (right - left)); | |
if(height[left] < height[right]) | |
left++; | |
else |
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 maxArea(vector<int>& height){ | |
int max = 0; | |
for(int i = 0; i < height.size()-1 ; i++){ | |
for(int j = i+1; j < height.size() ; j++){ | |
int vertical = 0; | |
if(height[i] < height[j]) | |
vertical = height[i]; | |
else |
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
#include <stdio.h> | |
#include <assert.h> | |
#include <cuda_runtime.h> | |
#include <helper_function.h> | |
#include <helper_cuda.h> | |
template <int BLOCK_SIZE> __global__ void MatrixMulCUDA(float *C, float *A, | |
float *B, int wA, int wB){ | |
//Block index | |
int bx = blockIdx.x; |
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
#include <stdio.h> | |
#include <cuda_duntime.h> | |
#include <helper_cuda.h> | |
#include <helper_functions.h> | |
__global__ void incermental_kernel(int *g_data, int inc_value) | |
{ | |
int idx = blockIdx.x * blockDim.x + threadIdx.x; | |
g_data[idx] = g_data[idx] + inc_value; | |
} |
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
#include <stdio.h> | |
#include <stdint.h> | |
static __device__ __inline__ uint32_t __mysmid(){ | |
uint32_t smid; | |
asm volatile("mov.u32 %0, %%smid;" : "=r"(smid)); | |
return smid; | |
} | |
static __device__ __inline__ uint32_t __mywarpid(){ |
NewerOlder