我在工作中时常使用form验证,在目前的公司做的表单验证用的angular的form组件,对于一个有追求的前端,或者应用在移动端写个form验证,引入angular或者jquery组件等验证,难免显得臃肿,最好是原生js吧,轻量.幸运 的等到这一课,加上之前所学,慢慢融合根据需求,应用到工作项目中... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR…
public class MinNumberInRotatedArray { public int getMinNumInRotatedArray(int[] array) { if(array == null) { return -1; } int leftIndex = 0; int rightIndex = array.length - 1; if(array[leftIndex] == array[rightIndex]) { return array[0]; } int midInde…
// ConsoleApplication10.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> #include <vector> #include <string> using namespace std; class BinarySearch { public: int getPos(vector<int> A, int n, int val) { //…
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example,Given [5, 7,…