摘要:
原题 暴力法: public static int maxArea(int[] height) { int n = height.length; int ans = 0; for(int i=0;i<n-1;i++){ for(int j=i+1;j<n;j++) { int len = j-i; 阅读全文
摘要:
原题 转成字符串,然后简单的判断一下。这里我自己转换要20ms,用库函数只需要11ms。只贴库函数转换的代码。 public static boolean isPalindrome(int x) { if(x<0) return false; String ans = String.valueOf( 阅读全文
摘要:
原题 这个题很简单的.最开始的想法是trim一下去掉开头的空格.然后放到字符串中,转成整数. public static int myAtoi(String str) { StringBuilder res = new StringBuilder(""); StringBuilder str2 = 阅读全文
摘要:
阅读全文
摘要:
1 不带回调的调起和返回 调起 //获取Intent Intent intent = new Intent(this,Main2Activity.class); //获取输入框中的数据 String par = et_par.getText().toString(); //把参数放到inten里面传 阅读全文
摘要:
Intent: 意图 Intent(Context packageContext, Class<?> cls) : 用于创建显示意图对象 Intent(String action): 用于创建隐式意图对象 putExtra(String name, Xxx value): 保存额外数据 Xxx ge 阅读全文
摘要:
阅读全文
摘要:
HttpServletResponse 类和 HttpServletRequest 类一样。每次请求进来,Tomcat 服务器都会创建一个 Response 对象传递给 Servlet 程序去使用。HttpServletRequest 表示请求过来的信息,HttpServletResponse 表示 阅读全文
摘要:
请求转发是指,服务器收到请求后,从一次资源跳转到另一个资源的操作叫请求转发。 servlet 1: // 获取请求的参数(办事的材料)查看 String username = req.getParameter("username"); System.out.println("在 Servlet1(柜 阅读全文
摘要:
方法一: // 获取请求参数 String username = req.getParameter("username"); //1 先以 iso8859-1 进行编码 //2 再以 utf-8 进行解码 username = new String(username.getBytes("iso-88 阅读全文