Skip to content

Instantly share code, notes, and snippets.

package com.company;
public class Main {
public static int search(int[] nums, int target) {
int mid, left = 0, right = nums.length-1;
while(left <= right){
mid = left + (right - left)/2;
if(nums[mid] == target) return mid;
if(target < nums[mid]) right = mid - 1;
@Alisherka7
Alisherka7 / 1 부터 n까지 합: 자료구조 실습과제.c
Created March 23, 2021 15:23
1 부터 n까지 합: 자료구조 실습과제
#include<stdio.h>
#include<time.h>
int sumAlgorithmA(int num)
{
return num*(num + 1) / 2;
}
int sumAlgorithmB(int num)
{
int sum = 0;